[NTG-context] xml TeX expansion?

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed Mar 17 12:14:37 CET 2010


Am 17.03.10 12:03, schrieb Hans van der Meer:
> Yes, I know that and already have made a setup for common commands 
> like <b>=\bf, <hr/>=\hairline etc. My point however is: How to avoid 
> the need to rewrite in this manner all ConTeXt macros one needs?
Maybe there is a way to let ConTeXt interpret the CDATA content, at the 
moment it is printed verbatim.

What you can also do is to write TeX content in a tex element and 
disable xml parsing.

A better way is to minimize your markup and inlcude rules etc. in other 
elements/environments (e.g. headers, descriptions ...)

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<test>
<![CDATA[
     This must be {\bf bold text}.
     ]]>
     This is <bf>bold text</bf>.
<tex>This is <bf>bold text</bf>.</tex>
</test>
\stopbuffer

\savebuffer[test][test.xml]

\startxmlsetups xml:testsetups
     \xmlsetsetup{test}{test|bf|tex}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

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

\startxmlsetups xml:tex
     \disableXML
     \xmlflush{#1}
\stopxmlsetups

\starttext

\xmlprocessfile{test}{test.xml}{}

\stoptext

Wolfgang



More information about the ntg-context mailing list