Am 03.03.2009 um 12:23 schrieb Hans Hagen:
A ConTeXt version of the filecontents for LaTeX would be handy in
such cases.
i have no clue what this means
Thomas was unable to show his problem with a buffer, the filecontents
environment is like a buffer but writes the content to a file with
a given name, e.g.
\begin{filecontentents}{example.xml}
<?xml version="1.0" encoding="utf-8"?>
<auth>
<section><content>Hello <</content></section>
</auth>
\end{filecontents}
...
\starttext
\xmlprocess{main}{example.xml}{}
\stoptext
Everything between \begin/end{filecontents} is written to the file
example.xml.
This is handy for example given on the list because attatchments are a
problem
in the mail archive and you have to create only one tex file for the
example.
Here is a example but it works only on MkII.
\unprotect
\def\startfilecontents
{\bgroup
\protectbuffersfalse
\dosingleargument\dostartfilecontents}
\def\dostartfilecontents[#1]%
{\beforesplitstring#1\at.\to\filename
\aftersplitstring #1\at.\to\extension
\let\f!temporaryextension\extension
\dostartbuffer[\filename][startfilecontents][stopfilecontents]}
\def\stopfilecontents
{\doifdefined{savebuffer}{\savebuffer[\filename]}\egroup}
\protect
\startfilecontents[a1.txt]
1 5
2 4
3 8
4 9
8 8
\stopfilecontents
\starttext
\readfile{a1.txt}{}{}
\stoptext
Wolfgang