Handling bad comments
Andrew Burday
andy at dep.philo.mcgill.ca
Thu Aug 3 15:11:36 PDT 1995
On Thu, 3 Aug 1995, Christian Neuss wrote:
>
> I must disagree.. handling comments correctly (like OmniWeb does) allows
> for "commenting out" not only text, but complete HTML code. An example:
> <!-- this is the <I> text </I> as it was before -->
> won't be displayed at all.
>
> By accepting every ">" as the end of comment, the text will be displayed
> like this:
> as it was before -->
A good point. I guess the ideal solution would be something like this:
After a "<!--", look for a "-->". If one is found before the next "<!-- "
or the end of the page (whichever comes first), assume that's the end of
the comment. If no "-->" is found, look for the ">" that immediately
succeeds the the "<!--", and use that ">" for the end of the comment.
That would prevent someone from accidentally commenting out their entire
document, as in the case I cited. It would also allow for the correct use
of comments that Christian cites. It would even work in perverse cases,
e.g. if someone had two comments on a page, with the *second* correctly
terminated but not the first. But it would prevent you from putting
comments around your comments. If you didn't try to handle the perverse
case -- ie, you searched only to the end of the document, not to the next
"<!--" -- then you could embed comments in comments. I imagine the scheme
could be complicated to handle *both* embedded comments and perverse
cases, too. You'd have to try to match close-comment-tags with
open-comment-tags. But I don't know how many such complications would be
worth the programmers' effort.
> need. Does anybody know how browsers other then NutScape behave?
This recently came up on the lynx-dev list. Apparently lynx treats
isolated ">"s as ends of comments. (Don't think I've checked recently
myself, but if that's what the programmers say...)
Best,
Andrew Burday
********************************************************************
andy at philo.mcgill.ca http://godel.philo.mcgill.ca/
---------------------------------------------------------------------
"The point of philosophy is to start with something so simple as not
to seem worth stating, and to end up with something so paradoxical
that no one will believe it."
Bertrand Russell, 'The Philosophy of Logical Atomism'
*********************************************************************
More information about the OmniWeb-l
mailing list