[ZPT] [BUG & PATCH] Parse restarts for incomplete entity reference

Dieter Maurer dieter@handshake.de
Fri, 7 Sep 2001 22:57:47 +0200 (CEST)


--p5o5JR7Yed
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

When ZPT's (version 1.4) HTML parser finds an incomplete entity (or character)
reference, it restarts parsing at the start.
If it encountered a macro definition before the incomplete
entity reference, this will lead to a

TAL.TALDefs.METALError: duplicate macro definition: ....

exception, as shown by the attached ZPT.

Patch attached...


Dieter


--p5o5JR7Yed
Content-Type: text/x-zpt
Content-Description: ZPT demonstrating parsing restart for incomplete entity/character reference
Content-Disposition: inline;
	filename="x.zpt"
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
  <head>
    <title>&amp; bug</title>
  </head>

  <body>
    <h1>&amp; bug</h1>
<p metal:define-macro="test"></p>
<p>a & b</p>



    <hr>
    <address><a href="mailto:dieter@handshake.de">Dieter Maurer</a></address>
<!-- Created: Fri Sep  7 22:03:51 CEST 2001 -->
<!-- hhmts start -->
Last modified: Fri Sep  7 22:39:53 CEST 2001
<!-- hhmts end -->
  </body>
</html>

--p5o5JR7Yed
Content-Type: application/x-patch
Content-Description: Patch for "parse restart for incomplete entity reference"
Content-Disposition: attachment;
	filename="zpt_parse_ent.pat"
Content-Transfer-Encoding: base64

LS0tIGxpYi9weXRob24vVEFMLzpIVE1MUGFyc2VyLnB5CVdlZCBKdWwgMTggMTg6MzU6NTQgMjAw
MQorKysgbGliL3B5dGhvbi9UQUwvSFRNTFBhcnNlci5weQlGcmkgU2VwICA3IDIyOjQ3OjIzIDIw
MDEKQEAgLTIxNiw2ICsyMTYsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UgSFRN
TFBhcnNlRXJyb3IoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVPRiBpbiBtaWRkbGUg
b2YgZW50aXR5IG9yIGNoYXIgcmVmIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxm
LmdldHBvcygpKQorICAgICAgICAgICAgICAgICAgICBzZWxmLnJhd2RhdGE9IHJhd2RhdGFbaTpd
CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAjIGluY29tcGxldGUKICAgICAgICAgICAg
ICAgICByYWlzZSBIVE1MUGFyc2VFcnJvcigiJyYnIG5vdCBwYXJ0IG9mIGVudGl0eSBvciBjaGFy
IHJlZiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5nZXRwb3Mo
KSkK

--p5o5JR7Yed--