Skip to content

Commit

Permalink
* Fixed handling whitespace at the end of a shortref
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wielemaker committed Nov 3, 2003
1 parent d20b814 commit ff36925
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Nov 3, 2003

* FIXED: Error parsing SHORTREF declaration that has whitespace at the
end. Richard O'Keefe.

Sep 12, 2003

* FIXED: Memory leak in load_structure/3 (not freeing the parser data).
Expand Down
41 changes: 41 additions & 0 deletions Test/mapbug.sgml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE D [

<!ELEMENT D O O (P+)>
<!ELEMENT P O O (#PCDATA|Q|M)*>
<!ELEMENT Q - - (#PCDATA|M)*>
<!ELEMENT M - - (#PCDATA)>

<!ENTITY P STARTTAG "P">
<!ENTITY beg.q STARTTAG "Q">
<!ENTITY end.q ENDTAG "Q">
<!ENTITY err.q STARTTAG "MISS-Q">
<!ENTITY beg.m STARTTAG "M">
<!ENTITY end.m ENDTAG "M">
<!ENTITY err.m STARTTAG "MISS-PCT">

<!SHORTREF For.D
"%" beg.m
"&#RS;&#RE;" P
'"' beg.q
>
<!USEMAP For.D (D|P)>

<!SHORTREF For.Q
"%" beg.m
"&#RS;&#RE;" err.q
'"' end.q
>
<!USEMAP For.Q (Q)>

<!SHORTREF For.M
"%" end.m
"&#RS;&#RE;" err.m
>
<!USEMAP For.M (M)>
]>
The "first" paragraph.

The "%2%nd" paragraph.

The %3%rd paragraph.

2 changes: 2 additions & 0 deletions Test/ok/mapbug.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[element(d, [], [element(p, [], ['The ', element(q, [], [first]), ' paragraph.']), element(p, [], ['The ', element(q, [], [element(m, [], ['2']), nd]), ' paragraph.']), element(p, [], ['The ', element(m, [], ['3']), 'rd paragraph.']), element(p, [], [])])].
[].
3 changes: 2 additions & 1 deletion parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,8 @@ process_shortref_declaration(dtd_parser *p, const ichar *decl)

sr->defined = TRUE;

while( *decl && (s=shortref_add_map(dtd, decl, sr)) )
while( *(decl = iskip_layout(dtd, decl)) != '\0'
&& (s=shortref_add_map(dtd, decl, sr)) )
decl = s;
compile_map(dtd, sr);

Expand Down

0 comments on commit ff36925

Please sign in to comment.