Re: Simple(?) comments question...

S.N.Brodie@ecs.soton.ac.uk wrote:
> 
> A further question is, what is the parser to make of any such text not
> held between the comment markers?  eg.
> 
> <!-- My Comment -- h1 -- start a level one heading? -- align=center -- put
> it in the middle? -->

According to nsgmls, it isn't legal. It would be legal if you removed
the "h1" and the "align=center", because you aren't allowed to have
anything between end comment tokens and start comment tokens. It would
also be legal if you doubled all the "--"s inside, viz:

<!-- My Comment ---- h1 ---- start a level one heading? ----
align=center ---- put it in the middle? -->

Joe English has a good page about this, and describes comment parsing
much more clearly than I can:

http://www.art.com/~joe/sgml/comments.html

> My parser ignores such things.  Should it?

I guess so, bearing in mind it is coping with illegal HTML.

> comment has not helped.  This issue has forced me to spend more time
> working on the comment parsing in my (custom written in C) parser than
> any other part of the HTML syntax. :-(

Here's an interesting one to throw at your parser:

<P>Some <!-- <A TITLE="---->" HREF="secret.html">secret</A> --> text.

The anchor title should end a comment and immediately start a second one
:-)

Chris

Received on Wednesday, 18 September 1996 07:56:47 UTC