[NTG-context] TeX control sequence inside XML param

Vit Zyka vit.zyka at seznam.cz
Mon Jan 31 10:30:48 CET 2005



Hans Hagen wrote:
> Vit Zyka wrote:
> 
> \startXMLdata
> <float>
>   <figure file="cow.pdf" context="width=.5&ctx-var-textwidth;" />
>   <figure file="hacker.jpg" context="width=3cm" />
>   <caption>Cow and hacker.</caption>
> </float>
> \stopXMLdata
 >
> food for thought ... (and the wiki)

That is a clever solution! This two pass tag processing. I have not been 
thinking this way yet. Thank you, Hans. (Wiki: 
http://contextgarden.net/Two_pass_tag_processing_example)

Unfortunately I have next two problems:
1) How to process <pre> HTML tag. I have tried many solution derived from
-----
\starttext
\defineXMLenvironment[pre]
   {\starttyping}
   {\stoptyping}
\startXMLdata
   <pre>
     Some code line.
     And another one.
   </pre>
\stopXMLdata
\stoptext
-----
but without success.

2) It seems to me there is some catcode clash inside XML environment:
-----
\defineXMLentity[hyphen]{|_|}
\starttext
   dojde|_|li
   \startXMLdata
     dojde&hyphen;li
   \stopXMLdata
\stoptext
------

Vit Zyka

> \starttext
> 
> \useMPlibrary[dum]
> 
> \defineXMLentity[ctx-var-textwidth] {\textwidth}
> 
> \defineXMLenvironmentsave
>   [float]
>   {\bgroup
>    \defineXMLsave[caption]%
>    \defineXMLignore[figure]}
>   {\XMLflush{float}%
>    \defineXMLignore
>      [caption]
>    \defineXMLcommand
>      [figure]
>      [file=dummy,context=]
>      {\expanded{\externalfigure
>        [\XMLflush{dir-fig}\XMLop{file}][\XMLop{context}]}%
>       \kern1em
>       \ignorespaces}%
>    \placefigure
>      {\XMLflush{caption}}
>      {\hbox{\ignorespaces\XMLflush{float}\removeunwantedspaces}}%
>    \egroup}
> 
> 
> \startXMLdata
> <float>
>   <figure file="cow.pdf" context="width=.5&ctx-var-textwidth;" />
>   <figure file="hacker.jpg" context="width=3cm" />
>   <caption>Cow and hacker.</caption>
> </float>
> \stopXMLdata
> 
> \stoptext


More information about the ntg-context mailing list