From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/76799 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: reading from standard input Date: Fri, 08 Jun 2012 14:44:41 +0200 Message-ID: <4FD1F3B9.7000903@wxs.nl> References: <4FD1EE44.2030302@stdin.fr> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339159509 4737 80.91.229.3 (8 Jun 2012 12:45:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 12:45:09 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Jun 08 14:45:07 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 1ScyYs-0001q9-29 for gctc-ntg-context-518@m.gmane.org; Fri, 08 Jun 2012 14:45:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AD1B6101EA; Fri, 8 Jun 2012 14:45:05 +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 ssdfK6GkX1CP; Fri, 8 Jun 2012 14:45:02 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B88D8101E2; Fri, 8 Jun 2012 14:45:02 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 66FF0101E2 for ; Fri, 8 Jun 2012 14:45:02 +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 syJztVFS-R5K for ; Fri, 8 Jun 2012 14:45:01 +0200 (CEST) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 2E573101DD for ; Fri, 8 Jun 2012 14:45:01 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q58Cj0x3003279 for ; Fri, 8 Jun 2012 14:45:00 +0200 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 5.3h2) with ESMTP (TLS) id 5546-1713362 for multiple; Fri, 08 Jun 2012 14:44:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20120604 Thunderbird/13.0 In-Reply-To: <4FD1EE44.2030302@stdin.fr> X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=03; city=Hattem; latitude=52.4724; longitude=6.0696; http://maps.google.com/maps?q=52.4724,6.0696&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03HjMJ0jw - 280960409a27 - 20120608 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 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:76799 Archived-At: On 8-6-2012 14:21, | Alexandre Leray wrote: > Hi, > > I was wondering if there was a way to make context read from stdin > instead of 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 transmiss= ion} > > 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 se= lon > les situations. Les situations seront mises en place en semaine > A et B > selon l'emploi du temps. Chaque nouvelle situation invente sa > m=E9thode. > \stoptext > """ > cmd =3D 'context --result=3D/tmp/result.pdf' > p1 =3D subprocess.Popen(cmd.split(" "), stdout=3Dsubprocess.PIPE, > stdin=3Dsubprocess.PIPE) > (stdout, stderr) =3D p1.communicate(stdin=3Dsrc) > you can use the standard tex input readers (\read) as well as io.read = when you're in lua Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________