[10313] in www-talk@info.cern.ch

home help back first fref pref prev next nref lref last post

Re: Simple(?) comments question...

daemon@ATHENA.MIT.EDU (Chris Ridd)
Wed Sep 18 10:56:02 1996

Date: Wed, 18 Sep 1996 12:56:05 +0100
From: Chris Ridd <C.Ridd@imc.exec.nhs.uk>
To: S.N.Brodie@ecs.soton.ac.uk
Cc: www-talk@w3.org
Resent-From: www-talk@w3.org

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


home help back first fref pref prev next nref lref last post