[NTG-context] Do environment files add implicit \starttext ... \stopttext

denis.maier at unibe.ch denis.maier at unibe.ch
Tue Nov 15 13:22:06 CET 2022


Hi,

if I process an XML buffer, I've noticed I need to wrap the \xmlprocessbuffer in a \starttext ... \stoptext pair.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\startbuffer[test]
<?xml version='1.0' standalone='yes?>
<document>
<p>a paragraph of text</p>
<p>another paragraph of text</p>
</document>
\stopbuffer

\startxmlsetups xml:demo
\xmlsetsetup{\xmldocument}{document|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:demo}

\startxmlsetups xml:document
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\endgraf
\stopxmlsetups

\starttext
  \xmlprocessbuffer{test}{test}{}
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

However, if I have the XML and the setups in dedicated files, there seems to be no need for \starttext ... \stoptext.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% text.xml
<?xml version='1.0' standalone='yes?>
<document>
<p>a paragraph of text</p>
<p>another paragraph of text</p>
</document>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% setups.tex
\startxmlsetups xml:demo
\xmlsetsetup{\xmldocument}{document|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:demo}

\startxmlsetups xml:document
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \xmlflush{#1}\endgraf
\stopxmlsetups
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Running
context text.xml -environment=setups.tex
gives me a proper PDF without errors.

Therefore my question:
Does the use -environment automatically wrap the processed file in \starttext ... stoptext ?

If not, what's the reason for this behaviour? Am I missing something?

Best,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20221115/d0ccfb85/attachment.htm>


More information about the ntg-context mailing list