Re: Inline macros

Murray Altheim (
Fri, 26 Apr 1996 14:20:29 -0500

Message-Id: <v02110102ada6c8a4e518@[]>
Date: Fri, 26 Apr 1996 14:20:29 -0500
To: David Ornstein <>
From: (Murray Altheim)
Subject: Re: Inline macros

David Ornstein <> writes:
[discussion on marked sections as script containers...]
>If you mean that it's a fair bit safer because ]] is less likely to occur in
>the data, this seems like a case of closeness in horseshoes and hand
>grenades.  SGML doesn't give any useful help here with anything like an
>escape character for the ']' does it?  You show the example above having
>been BinHex'd which is cheating a bit.  If I wanted to, say, have a PERL
>script in the marked section (roughly akin to the original intent in this
>thread), what do I do if my script has a ']]' in it? (I do see your note
>below about using an entity, but sometimes that wouldn't be done...)

Well, I chose a bad example (a binhex document) but it did occur to me that
since we're really talking here about scripts and not arbitrary data, the
author has control (or at least knowledge) of the presence or absence of
MSC (ie., ']]') in the embedded text. And yes, there is an SGML solution:
rather than using a CDATA marked section, declare MSC as an entity literal
and use an 'RCDATA' marked section. RCDATA (where the 'R' stands for
replaceable) means that entity references are replaced upon being
processed. Here's a convoluted example of an CDATA marked section embedded
in an RCDATA marked section that would not be processed, but rather

declare the entity &msc; in the declaration subset:

    <!DOCTYPE html PUBLIC "-//Spyglass//DTD HTML 2.0 Extended" [
        <!ENTITY msc "]]">

in document instance:

    <P>Here's an example of a CDATA marked section:</P>
    <![ RCDATA [
        &lt![ CDATA [
            -- some CDATA content --

This would display as:

    Here's an example of a CDATA marked section:

        <![ CDATA [
             -- some CDATA content --

Now, if we create a construct like:

        <![ RCDATA [
             -- some perl script --

The perl script could contain ']]' escaped as '&msc;'. Any other entities
would be replaced here as well, which opens up some interesting

The biggest benefit here is that embedded content could have all sorts of
syntactical constructs (which might be found in perl, Javascript, etc.)
that would be illegal in SGML/HTML but within a marked section (apart from
MSC) it's all fine. Any browser understanding marked sections could process
this correctly. Note that the parsing requirements here are quite minimal
compared to some proposals I've seen.

Anyone interested in how marked sections work can check the "Gentle
Introduction to SGML" at

Paul had pointed out to me a better method of embedding non-SGML data (I
don't disagree), but for purposes of this thread I think we've gotten a bit
off track here.


     Murray Altheim, Program Manager
     Spyglass, Inc., Cambridge, Massachusetts
     email: <>
     http:  <>
            "Give a monkey the tools and he'll eventually build a typewriter."