Merge "Improve "selfmove" message's wording"
[lhc/web/wiklou.git] / includes / parser / BlockLevelPass.php
index 2023d13..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 ) {
@@ -286,14 +291,14 @@ class BlockLevelPass {
                                # @todo consider using a stack for nestable elements like span, table and div
                                $openMatch = preg_match(
                                        '/(?:<table|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|'
-                                               . '<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS',
+                                               . '<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)\\b/iS',
                                        $t
                                );
                                $closeMatch = preg_match(
                                        '/(?:<\\/table|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'
                                                . '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|<\\/mw:|'
                                                . Parser::MARKER_PREFIX
-                                               . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS',
+                                               . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)\\b/iS',
                                        $t
                                );