[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Invisible URL

From: David Woolley
Subject: Re: lynx-dev Invisible URL
Date: Sat, 16 May 1998 11:00:03 +0100 (BST)

> <!-- "#4d66cb" 0d219e --!>
> Comments need to end in "-->" ... no "!" ... thus the page appears to lynx
> as one big comment with no ending comment mark.

This is not true.  It is dubious HTML, but the comment is cleanly closed.
Comments are closed by --, not -->.  The point to remember is there is no
real comment mechanism for HTML, only one for SGML declarations, so
an "HTML comment" is really a null SGML declaration, with everything within
the tag commented out.  As such, the example comment probably reduces to:
<! !>, which is an invalid directive, but definitely terminated.)

The HTML 4.0 spec is a little confusing in this area, in that it specifies
a subset of the format allowed by SGML, and only introduces the full SGML
rules in a note about avoiding embedded -s.

If you look at the HTML DTD, you can see many examples of commented SGML,
where the comments don't end immediately before a >.

I think the problem (Lynx 2-7-2 code) is in SGML.c around these lines:

  2305          }
  2306          context->first_dash = FALSE;
  2307          if (context->end_comment && !isspace(c))
  2308              context->end_comment = FALSE;
  2309          HTChunkPutc(string, c);
  2310          break;
  2312      case S_doctype:             /* Expecting DOCTYPE. - FM */
  2313          if (context->doctype_bracket) {

I think lines 2307 and 2308 should either be omitted (if one is always
going to ignore the contents of anything starting <!--) or should put the
scanner into the post ! state, or into some special state.

Note that this would change the semantics of minimal comment mode, so one
might need to retain this check in minimal mode.

I need to check the book, in the office, on SGML to see whether these cases
are also valid SGML:

<!--The type of document--DOCTYPE.....

<a -- This is an anchor element --
 href="http:......" -- this is the URL it references -- >

although I strongly doubt that any GUI browser would cope with the second,
even if it is.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]