Open d-maurer opened 5 years ago
@malthe Shouldn't this be marked as a bug and not a feature?
I suppose in this case it's a bit of a grey area :-)
Malthe Borch wrote at 2020-7-15 12:47 -0700:
I suppose in this case it's a bit of a grey area :-)
I have spent hours to understand what happened in a concrete (complex) case: in this case, I got a parser error "mismatched closing tag" far below the buggy open tag (and not refering to it).
Just ignoring an open tag containing some type of bugs is not helpful for locating the problem.
This is a reformulation of https://github.com/zopefoundation/Zope/issues/710.
When the template
is parsed with content type
text/html
, the parser correctly recognizes the malformeddiv
start tag and callsvisit
onchameleon.parser.ElementParser
with kinderror
. This looks forvisit_error
and because this is undefined usesvist_default
instead -- which turns the bad start tag into a text node. As a consequence, the start/end tag structure is broken and an error is reported (potentially much) later regarding a mismatch end tag.ElementParser
should definevisit_error
and ensure that the error is reported immediately.