ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: mw@miwie.in-berlin.de, ntg-context@ntg.nl
Subject: Re: CDATA/XML
Date: Wed, 06 Mar 2002 11:50:05 +0100	[thread overview]
Message-ID: <5.1.0.14.1.20020306114819.03504008@server-1> (raw)
In-Reply-To: <20020306104552.148a7bc2.taco@elvenkind.com>

At 10:45 AM 3/6/2002 +0100, Taco Hoekwater wrote:

> > > How does ConTeXt handle CDATA sections in XML?
> >
> > Incorrectly :). I'd post a fix later today.
> >
> > Meanwhile, this works OK:
>
>Oops, it didn't. :(
>
>Here is a fix for Context that makes sure it behaves ok wrt.
>CDATA sections. Should be included somewhere on top of the document
>or in cont-usr.tex (until it makes it into the distribution)
>
>
>% start of patch
>\let\doxparseXMLescape\xparseXMLescape
>\def\xparseXMLescape!#1%
>    {\if[#1%
>        \expandafter\expandafter\expandafter\doCDATAsection
>     \else \if-#1%
>        \expandafter\expandafter\expandafter\doCOMMENT
>     \else
>        \expandafter\expandafter\expandafter\doparseXMLescape
>     \fi\fi !#1}
>
>\def\doCDATAsection![#1[%
>   {\skipfirstverbatimlinefalse
>    \processtaggeddisplayverbatim{]]>}}
>
>\def\doCOMMENT {\gobbleuntil{-->}}
>% end of patch

In the beta the patch is:

in xtag-ini: grab #1 from ]...]

\long\def\xparseXMLescape !#1#2%
   {\if#1-%
      \if#2-%
        \expandafter\expandafter\expandafter\xxparseXMLescape
      \else
        \expandafter\expandafter\expandafter\xyparseXMLescape
      \fi
    \else
      \if#1[%
        \expandafter\expandafter\expandafter\xzparseXMLescape
      \else
        \expandafter\expandafter\expandafter\xyparseXMLescape
      \fi
    \fi#1#2}

\long\def\xzparseXMLescape[#1[{\parseXMLescape{#1}}

in xtag-pre: {CDATA]} => CDATA

\defineXMLescape [CDATA]
   {\skipfirstverbatimlinefalse
    \processtaggeddisplayverbatim{]]>}}

So, this way we keep the installable parser in place

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-ade.nl
-------------------------------------------------------------------------


  parent reply	other threads:[~2002-03-06 10:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-05 19:30 CDATA/XML Michael Wiedmann
2002-03-06  8:19 ` CDATA/XML Taco Hoekwater
2002-03-06  9:45   ` CDATA/XML Taco Hoekwater
2002-03-06 10:17     ` CDATA/XML Hans Hagen
2002-03-06 11:39       ` CDATA/XML Michael Wiedmann
2002-03-06 12:42         ` CDATA/XML Hans Hagen
2002-03-06 13:56           ` CDATA/XML Taco Hoekwater
2002-03-06 13:54         ` CDATA/XML Taco Hoekwater
2002-03-06 10:50     ` Hans Hagen [this message]
2002-03-06 19:45       ` CDATA/XML Michael Wiedmann
2002-03-06 21:48         ` CDATA/XML Hans Hagen
2002-03-13 12:47           ` CDATA/XML Michael Wiedmann
2002-03-13 14:32             ` CDATA/XML Taco Hoekwater
2002-03-13 14:34             ` CDATA/XML Hans Hagen
2002-03-06 11:09     ` CDATA/XML Michael Wiedmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5.1.0.14.1.20020306114819.03504008@server-1 \
    --to=pragma@wxs.nl \
    --cc=mw@miwie.in-berlin.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).