"Hans Hagen" <[EMAIL PROTECTED]> wrote:
> At 03:20 PM 11/26/2001 +0100, Patrick Gundlach wrote:
> >Hi,
> >
> >xml comments have a bug (!?): spaces are critical at the
> >beginning of a comment.
>
> you may try (and play with):
>
> \long\def\xparseXMLescape !#1#2#3{\parseXMLescape{#1#2}#3}
Adding #3 is safe, sort of. <! is always followed by one of the language's
keywords, and <!-- is by far the shortest of those. Just watch out
that <!----> is a valid comment (although very unlikely to appear).
The string "<!-- crap -->" is actually a comment that starts with
a space. The comment itself in this case is: " crap ".
It is possible to take advantage of the fact that '<!--' is the only
keyword that starts with the same character twice, so the 'best' thing
to do is something along these lines:
\long\def\xparseXMLescape!#1#2%
{\if#1#2%
\@EA\handleXMLcomment
\else
\@EA\doxparseXMLescape
\fi#1#2}
\def\handleXMLcomment--#1-->{}
\def\doxparseXMLescape#1 {\parseXMLescape{#1}}
--
groeten,
Taco