When parsing a single line definition list, we track nested tags so that:
; <b>foo:bar</b>: baz
breaks before `baz`, not between `foo` and `bar`. But we currently bail
out of this algorithm entirely if we see a mismatched close tag. We should
just ignore the unmatched tag, like Parsoid does.
Change-Id: I6306dcad6347abeb6ab001d35562f1ab9f374bd1
case self::COLON_STATE_CLOSETAG:
# In a </tag>
if ( $c === ">" ) {
case self::COLON_STATE_CLOSETAG:
# In a </tag>
if ( $c === ">" ) {
- $ltLevel--;
- if ( $ltLevel < 0 ) {
+ if ( $ltLevel > 0 ) {
+ $ltLevel--;
+ } else {
+ # ignore the excess close tag, but keep looking for
+ # colons. (This matches Parsoid behavior.)
wfDebug( __METHOD__ . ": Invalid input; too many close tags\n" );
wfDebug( __METHOD__ . ": Invalid input; too many close tags\n" );
}
$state = self::COLON_STATE_TEXT;
}
}
$state = self::COLON_STATE_TEXT;
}
+!! test
+Definition lists: ignore colons inside tags
+!! wikitext
+;one <b>two : tag <i>fun:</i>:</b>: def
+!! html
+<dl><dt>one <b>two : tag <i>fun:</i>:</b></dt>
+<dd> def</dd></dl>
+
+!! end
+
+!! test
+Definition lists: excess closed tags
+!! wikitext
+;one</b>two : bad tag fun
+!! html/php+tidy
+<dl>
+<dt>onetwo </dt>
+<dd>bad tag fun</dd>
+</dl>
+!! html/parsoid
+<dl>
+<dt>onetwo</dt>
+<dd>bad tag fun</dd>
+</dl>
+!! end
+
!! test
Bug 11748: Literal closing tags
!! wikitext
!! test
Bug 11748: Literal closing tags
!! wikitext