[NTG-context] Parallel output of source data

Wolfgang Schuster schuster.wolfgang at gmail.com
Fri Dec 2 20:04:56 CET 2016


> Procházka Lukáš Ing. <mailto:LPr at pontex.cz>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20161202/1ece2219/attachment-0001.html>


More information about the ntg-context mailing list