From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/76800 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: reading from standard input Date: Fri, 8 Jun 2012 09:31:24 -0400 (EDT) Message-ID: References: <4FD1EE44.2030302@stdin.fr> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-146776008-1339162285=:13850" X-Trace: dough.gmane.org 1339162298 31335 80.91.229.3 (8 Jun 2012 13:31:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 13:31:38 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Jun 08 15:31:36 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SczHq-0004Oi-KT for gctc-ntg-context-518@m.gmane.org; Fri, 08 Jun 2012 15:31:34 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 209F9101E5; Fri, 8 Jun 2012 15:31:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xhB5GVhx8w+s; Fri, 8 Jun 2012 15:31:31 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7F995101E2; Fri, 8 Jun 2012 15:31:31 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 911DE101E2 for ; Fri, 8 Jun 2012 15:31:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9lvL9JkEB4Rp for ; Fri, 8 Jun 2012 15:31:29 +0200 (CEST) Original-Received: from filter2-nij.mf.surf.net (filter2-nij.mf.surf.net [195.169.124.153]) by balder.ntg.nl (Postfix) with ESMTP id 52190101DD for ; Fri, 8 Jun 2012 15:31:28 +0200 (CEST) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by filter2-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q58DVQd0013159 for ; Fri, 8 Jun 2012 15:31:27 +0200 Original-Received: FROM adi-netbook (bas3-montreal02-1096682554.dsl.bell.ca [65.94.12.58]) By hellskitchen.mr.itd.umich.edu ID 4FD1FEAD.9A2F6.22116 ; Authuser adityam; 8 Jun 2012 09:31:25 EDT In-Reply-To: <4FD1EE44.2030302@stdin.fr> User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.82; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0aHjNvrRu - 9d5999823cd1 - 20120608 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.153 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.13 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:76800 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-146776008-1339162285=:13850 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 8 Jun 2012, | Alexandre Leray wrote: > Hi, > > I was wondering if there was a way to make context read from stdin instea= d of=20 > reading from a file? > > cat /path/to/src.tex | context --result=3D/path/to/result.pdf > > I'd like to do something like this in python: > > def generate_pdf(self): > > src =3D """ > \starttext > \section[=E9l=E9ments-de-transmission]{=C9l=E9ments de transmissio= n} > > Un module dans lequel une communaut=E9 temporaire d'=E9tudiants et > d'enseignants s'exerce =E0 mettre en situation des r=E9flexions et= des > moments de transmission en interrogeant sans cesse la question de > l'enseignement. La configuration des enseignants est variable selo= n > les situations. Les situations seront mises en place en semaine A = et=20 > B > selon l'emploi du temps. Chaque nouvelle situation invente sa=20 > m=E9thode. > \stoptext > """ > cmd =3D 'context --result=3D/tmp/result.pdf' > p1 =3D subprocess.Popen(cmd.split(" "), stdout=3Dsubprocess.PIPE,= =20 > stdin=3Dsubprocess.PIPE) > (stdout, stderr) =3D p1.communicate(stdin=3Dsrc) > You can try context --pipe --result=3D/tmp/result.pdf but that only runs th= e=20 document once, so cross referencings, TOC, etc won't work correctly. The=20 other options is to write to a file, and then run "context --purgeall=20 --result=3D/tmp/result.pdf filename"; this will run the document appropriat= e=20 number of times, and then delete the temp files, leaving only the .tex and= =20 the .pdf file. Aditya --8323328-146776008-1339162285=:13850 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --8323328-146776008-1339162285=:13850--