Re: Comment Declarations

Joe English (
Tue, 30 May 95 01:09:08 EDT

On 15 May 95,
Daniel W. Connolly <> wrote:

> In message <>, Glenn Adams writes:
> >Is it possible to correct the specification of comment declarations
> >in 2.0 so that it matches ISO 8879?
> I've written several explanations of this, but none of which is
> both consistent with ISO8879 and comprehensible.
> Would you care to give it a whirl?

Here's a revised version of a message I just
sent to the comp.infosystems.www.authoring.html FAQ
maintainer; perhaps it will be useful:

Comment declarations may appear anywhere in
the document content. Comment declarations
are ignored by the parser, and may be used
to include human-readable comments in the
HTML source.

The syntax of comment declarations is as follows:

"<!" (MDO delimiter),
followed by zero or more occurrences of:
"--" (COM delimiter),
any text not containing "--",
"--" (COM delimiter), and
optional separator characters (whitespace);
followed by ">" (MDC delimiter).

NOTE - Comment declaration syntax may be specified by the
Perl regular expression

<!(--([^-]|-[^-])*--[ \t\n]*)*+>

"<!" (MDO) is the "markup declaration open" delimiter.
If it is immediately followed by a "--" then it starts
a "comment declaration". Comment declarations may
contain multiple "comments", where a "comment" is arbitrary
text delimited by "--" (COM) at the beginning and the end.
">" (MDC) is the "markup declaration close" delimiter;
it closes the comment declaration.

NOTE - "--" terminates the *comment*, while ">" terminates the
*declaration*. That's why <!-- this -- > is a legal
comment, but <!-- this -- here --> is not.

Comments may also appear inside other markup declarations
in the DTD. Comments and comment declarations may not
appear inside tags. Comments and comment declarations
do not nest.

<!>, <!-- foo -->, <!-- foo -- -- bar -- >, and <!--------> (8 hyphens)
are all legal comment declarations.

NOTE - for bugward compatibility, comments should not
contain the characters ">", "<", or end-of-line, comment
declarations should not contain more than one comment, and
there should be no whitespace between the final "--" (COM)
delimiter and the closing ">" (MDC) delimiter in a comment
declaration, as some historical implementations incorrectly
interpret these constructs.

--Joe English