From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/76798 Path: news.gmane.org!not-for-mail From: " | Alexandre Leray" Newsgroups: gmane.comp.tex.context Subject: reading from standard input Date: Fri, 08 Jun 2012 14:21:24 +0200 Message-ID: <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="===============1377344023==" X-Trace: dough.gmane.org 1339157697 21290 80.91.229.3 (8 Jun 2012 12:14:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 12:14:57 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Jun 08 14:14:55 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 1Scy5Z-0005sH-LN for gctc-ntg-context-518@m.gmane.org; Fri, 08 Jun 2012 14:14:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 81C26101E7; Fri, 8 Jun 2012 14:14:48 +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 GxdruUJja+qu; Fri, 8 Jun 2012 14:14:46 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3160C101E2; Fri, 8 Jun 2012 14:14:46 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3914C101E2 for ; Fri, 8 Jun 2012 14:14:45 +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 gF7Hozql5r4K for ; Fri, 8 Jun 2012 14:14:44 +0200 (CEST) Original-Received: from filter1-nij.mf.surf.net (filter1-nij.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id F28B9101DD for ; Fri, 8 Jun 2012 14:14:43 +0200 (CEST) Original-Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by filter1-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q58CEgds023790 for ; Fri, 8 Jun 2012 14:14:43 +0200 X-Originating-IP: 217.70.178.143 Original-Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 68625A807B for ; Fri, 8 Jun 2012 14:14:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id vjKPAFa3WWpB for ; Fri, 8 Jun 2012 14:14:01 +0200 (CEST) X-Originating-IP: 91.183.56.178 Original-Received: from [192.168.0.157] (unknown [91.183.56.178]) (Authenticated sender: alexandre@stdin.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id CD152A80DB for ; Fri, 8 Jun 2012 14:14:00 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=217.70.183.195; country=FR; latitude=46.0000; longitude=2.0000; http://maps.google.com/maps?q=46.0000,2.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07HjMeGjm - edf5a06526c0 - 20120608 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.152 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:76798 Archived-At: This is a multi-part message in MIME format. --===============1377344023== Content-Type: multipart/alternative; boundary="------------000603060207040300080509" This is a multi-part message in MIME format. --------------000603060207040300080509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Hi, I was wondering if there was a way to make context read from stdin=20 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 d= e l'enseignement. La configuration des enseignants est variable se= lon les situations. Les situations seront mises en place en semaine=20 A et 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) Thanks, Alex --=20 Alexandre Leray media& graphic design http://stdin.fr | http://osp.constantvzw.org/ rue Gallaitstraat 80 1030 Bruxelles +32 (0)4 87 04 70 30 --------------000603060207040300080509 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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=/path/to/result.pdf

I'd like to do something like this in python:
   

    def generate_pdf(self):

        src = """
        \starttext
        \section[éléments-de-transmission]{Éléments de transmission}

        Un module dans lequel une communauté temporaire d'étudiants et
        d'enseignants s'exerce à mettre en situation des réflexions et des
        moments de transmission en interrogeant sans cesse la question de
        l'enseignement. La configuration des enseignants est variable selon
        les situations. Les situations seront mises en place en semaine A et B
        selon l'emploi du temps. Chaque nouvelle situation invente sa méthode.
        \stoptext
        """
        cmd = 'context --result=/tmp/result.pdf'
        p1 = subprocess.Popen(cmd.split(" "), stdout=subprocess.PIPE, stdin=subprocess.PIPE)
        (stdout, stderr) = p1.communicate(stdin=src)


Thanks,

Alex
-- 
Alexandre Leray
media & graphic design
http://stdin.fr | http://osp.constantvzw.org/
rue Gallaitstraat 80
1030 Bruxelles 
+32 (0)4 87 04 70 30
--------------000603060207040300080509-- --===============1377344023== 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 ___________________________________________________________________________________ --===============1377344023==--