From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/96934 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Parallel output of source data Date: Fri, 02 Dec 2016 20:04:56 +0100 Message-ID: <5841C5D8.4090201@gmail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2029781338720868279==" X-Trace: blaine.gmane.org 1480705774 27603 195.159.176.226 (2 Dec 2016 19:09:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2016 19:09:34 +0000 (UTC) User-Agent: Postbox 5.0.8 (Macintosh/20161122) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Dec 02 20:09:21 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCtCy-0004in-LD for gctc-ntg-context-518@m.gmane.org; Fri, 02 Dec 2016 20:09:20 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CAB6C81A54; Fri, 2 Dec 2016 20:05:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pskuITMKfEFU; Fri, 2 Dec 2016 20:05:13 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 2281181A64; Fri, 2 Dec 2016 20:05:13 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 86F5281A5C for ; Fri, 2 Dec 2016 20:05:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1_pTLPvy5viN for ; Fri, 2 Dec 2016 20:05:09 +0100 (CET) Original-Received: from mail-wj0-f169.google.com (mail-wj0-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id AE95481869 for ; Fri, 2 Dec 2016 20:04:59 +0100 (CET) Original-Received: by mail-wj0-f169.google.com with SMTP id v7so239684922wjy.2 for ; Fri, 02 Dec 2016 11:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=qxWcmOUpUJwNkXE4NVg5uFRwvYqKI3oXkZKvV2q9tjM=; b=iqQQ+pTQWnh8nuYaLN9pCmhcVb7Oww99SrYkaprFA5m6Mc0sSgW3AD2eJr/FxfJO3T cBsUNTP+TAGeh+hxCRQ9A6xDlTeFiz7leuXXL/YHPGSbSX/ewt/bjjZDz40wsLizULtv UH31vhYuTAQYI1fbTcBZxvNEP8Ke5tREG06ezjiu2F+XuvK2IKcLTBB2nNzHqIVKESc6 r5mMpr5wZWM9mdwc4yYk1TQU328EcLaSMWFuNOTs+HSy74faZNqd7ANlmuFl74YMnyW4 1Zy93thb7EmURjBR3zvsPKoSx3Ybr2cMpijMOHat+wAbfPlUV+zO90VDxdgXmKbxlitF ufxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=qxWcmOUpUJwNkXE4NVg5uFRwvYqKI3oXkZKvV2q9tjM=; b=V5K7QSvz4RsoydjsCPbRtmmIrmpYlgh75uJDpEnZJOynrf3u/Emu/bbbLMuSIw2657 xE/6jerYU6ayv6dh+eAmKhbOPV8z3XFYLR1QLru/bJyZ/o3rzTLmLuciLX7ggraUVaak fUbCRGMtu3/yvtUCQe1BOsuNDQ+E07xHE9yuCqPNJN/6nSItV1i/tIttKg+1RyBdFYzR JLMbUECW4Q3nPYcPB3kXmeuSjrY8jiIgsxvY3ak3MH/V1H8jg3cSmJzL4TMM1dj1U0um aYkaSCxK7hzouGiOcTD2CKNCGC6tpTwkbJ3wN/uIODkMwErclb3A2YIakwGtmGCJMjzH RoCQ== X-Gm-Message-State: AKaTC02udEQbDulcq2lv/rzkNcBr9aHBks277Fl3qb2a0OnkVfncCjyzhoQuAE3WzaqIzQ== X-Received: by 10.194.2.198 with SMTP id 6mr45486260wjw.51.1480705499154; Fri, 02 Dec 2016 11:04:59 -0800 (PST) Original-Received: from keima.localdomain (x2f25d4f.dyn.telefonica.de. [2.242.93.79]) by smtp.gmail.com with ESMTPSA id ua15sm7028763wjb.1.2016.12.02.11.04.58 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 11:04:58 -0800 (PST) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:96934 Archived-At: This is a multi-part message in MIME format. --===============2029781338720868279== Content-Type: multipart/alternative; boundary="------------010902090608060306010603" This is a multi-part message in MIME format. --------------010902090608060306010603 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit > Procházka Lukáš Ing. > 2. Dezember 2016 um 08:10 > Hello, > > is there a way to let ConTeXt to flush the input stream in parallel > into an output buffer, like: > > ---- > \starttext > > A > > \startoutput{Test.mkiv} > Hello! > \startitemize > \item Item > \stopitemize > \stopoutput > > B > > \stoptext > ---- > > which would produce: > > ---- Test.mkiv > Hello! > \startitemize > \item Item > \stopitemize > ---- You can use a buffer to store content and save it in a external file. \unexpanded\def\startcontentexport {\dosingleempty\dostartcontentexport} \def\dostartcontentexport[#1]% {\iffirstargument \edef\contentexportfile{#1}% \else \let\contentexportfile\empty \fi \grabbufferdata[contentexport][startcontentexport][stopcontentexport]} \def\stopcontentexport {\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}% \getbufferdata[contentexport]} \starttext A \startcontentexport[Test.mkiv] Hello! \startitemize \item Item \stopitemize \stopcontentexport B \stoptext Wolfgang --------------010902090608060306010603 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
2. Dezember 2016 um 08:10
Hello,

is there a way to let ConTeXt to flush the input stream in parallel into an output buffer, like:

----
\starttext

A

\startoutput{Test.mkiv}
  Hello!
  \startitemize
    \item Item
  \stopitemize
\stopoutput

B

\stoptext
----

which would produce:

---- Test.mkiv
  Hello!
  \startitemize
    \item Item
  \stopitemize
----
You can use a buffer to store content and save it in a external file.

\unexpanded\def\startcontentexport
  {\dosingleempty\dostartcontentexport}

\def\dostartcontentexport[#1]%
  {\iffirstargument
     \edef\contentexportfile{#1}%
   \else
     \let\contentexportfile\empty
   \fi
   \grabbufferdata[contentexport][startcontentexport][stopcontentexport]}

\def\stopcontentexport
  {\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}%
   \getbufferdata[contentexport]}

\starttext

A

\startcontentexport[Test.mkiv]
  Hello!
  \startitemize
    \item Item
  \stopitemize
\stopcontentexport

B

\stoptext

Wolfgang
--------------010902090608060306010603-- --===============2029781338720868279== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============2029781338720868279==--