ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "<stdin> | Alexandre Leray" <alexandre@stdin.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: reading from standard input
Date: Fri, 08 Jun 2012 14:21:24 +0200	[thread overview]
Message-ID: <4FD1EE44.2030302@stdin.fr> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1259 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 2563 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

             reply	other threads:[~2012-06-08 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 12:21 <stdin> | Alexandre Leray [this message]
2012-06-08 12:44 ` Hans Hagen
2012-06-08 13:31 ` Aditya Mahajan
2012-06-08 14:32   ` <stdin> | Alexandre Leray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FD1EE44.2030302@stdin.fr \
    --to=alexandre@stdin.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).