Tk Library Source Code

View Ticket
Login
Ticket UUID: 861287
Title: htmlparse: comment delimiters
Type: Bug Version: None
Submitter: jenglish Created on: 2003-12-16 21:37:48
Subsystem: htmlparse Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-09-22 10:10:03
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2004-09-22 03:10:03
Description:
htmlparse::parse doesn't parse comments correctly.
One example:

htmlparse::parse "<pre>&lt;-- a comment --></pre>"

The closing delimiter "-->" gets turned into \01, and
never gets turned back.  (This is legal HTML BTW, found
in the wild).

It also fails to recognize comments if there is a space
between the final COM (--) and MDC (>) delimiters.
User Comments: andreas_kupries added on 2004-09-22 10:10:03:
Logged In: YES 
user_id=75003

The relevant part of the spec is

  http://www.w3.org/MarkUp/html-spec/html-spec_3.html#SEC3.2.5

BOC is always '<!--'. '<--' is not legal. Tidy converts this
into an entities, and essentially converts the whole string
into a PCDATA section, plain text. Htmlparse is now doing
the same.

EOC is indeed allowed to have whitespace between '--' and
the closing '>'. This has been fixed, by replacing the
relevant [string map] with a [regsub].

All changes have been made to the command "PrepareHtml".

The changes have been committed to the Tcllib Head.

jenglish added on 2003-12-17 04:53:56:
Logged In: YES 
user_id=68433


Possible fix: add the pair "\01" "-->" to the
$::htmlparse::escapes string map, so [htmlparse::mapEscapes]
will change it back.

Don't know what to do about parsing "<!-- ....-- >", this
part is beyond me.