Merge "Don't percent-encode HTML5 IDs"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 12 Sep 2017 01:38:59 +0000 (01:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 12 Sep 2017 01:38:59 +0000 (01:38 +0000)
includes/parser/BlockLevelPass.php
tests/parser/parserTests.txt

index 599fbf6..fab9ab7 100644 (file)
@@ -257,12 +257,17 @@ class BlockLevelPass {
                                        $output .= $this->nextItem( $prefix[$commonPrefixLength - 1] );
                                }
 
+                               # Close an open <dt> if we have a <dd> (":") starting on this line
+                               if ( $this->DTopen && $commonPrefixLength > 0 && $prefix[$commonPrefixLength - 1] === ':' ) {
+                                       $output .= $this->nextItem( ':' );
+                               }
+
                                # Open prefixes where appropriate.
                                if ( $lastPrefix && $prefixLength > $commonPrefixLength ) {
                                        $output .= "\n";
                                }
                                while ( $prefixLength > $commonPrefixLength ) {
-                                       $char = substr( $prefix, $commonPrefixLength, 1 );
+                                       $char = $prefix[$commonPrefixLength];
                                        $output .= $this->openList( $char );
 
                                        if ( ';' === $char ) {
index bf2679f..00d2538 100644 (file)
@@ -4332,6 +4332,21 @@ Definition Lists: Mixed Lists: Test 10
 
 !! end
 
+# This is a regression test for T175099
+# html/php+tidy is insufficient since Tidy covers up the bug.
+# But once Tidy is replaced with RemexHTML, html/php+tidy is good enough
+!! test
+Definition Lists: Mixed Lists: Test 11
+!! wikitext
+;a
+:*b
+!! html
+<dl><dt>a</dt>
+<dd>
+<ul><li>b</li></ul></dd></dl>
+
+!! end
+
 # The Parsoid team disagrees with the PHP parser's seemingly-random
 # rules regarding dd/dt on the next two tests.  Parsoid is more
 # consistent, and recognizes the shared nesting and keeps the
@@ -4339,7 +4354,7 @@ Definition Lists: Mixed Lists: Test 10
 # (And tidy again converts <dt> to <dd> before 'bar'.)
 
 !! test
-Definition Lists: Mixed Lists: Test 11
+Definition Lists: Mixed Lists: Test 12
 !! wikitext
 *#*#;*;;foo :bar
 *#*#;boo :baz