Merge "Make TOC hideable"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 24 Oct 2013 19:22:32 +0000 (19:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 24 Oct 2013 19:22:32 +0000 (19:22 +0000)
1  2 
includes/OutputPage.php
includes/parser/Parser.php
tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/phpunit/includes/parser/NewParserTest.php

diff --combined includes/OutputPage.php
@@@ -255,6 -255,11 +255,11 @@@ class OutputPage extends ContextSource 
         */
        private $mTarget = null;
  
+       /**
+        * @var bool: Whether output should contain table of contents
+        */
+       private $mEnableTOC = true;
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
         *
         * @param $timestamp string
         *
 -       * @return Boolean: true iff cache-ok headers was sent.
 +       * @return Boolean: true if cache-ok headers was sent.
         */
        public function checkLastModified( $timestamp ) {
                global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage;
         */
        function addParserOutput( &$parserOutput ) {
                $this->addParserOutputNoText( $parserOutput );
+               $parserOutput->setTOCEnabled( $this->mEnableTOC );
                $text = $parserOutput->getText();
                wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
                $this->addHTML( $text );
@@@ -3648,4 -3654,20 +3654,20 @@@ $template
                return array();
        }
  
+       /**
+        * Enables/disables TOC, doesn't override __NOTOC__
+        * @param bool $flag
+        * @since 1.22
+        */
+       public function enableTOC( $flag = true ) {
+               $this->mEnableTOC = $flag;
+       }
+       /**
+        * @return bool
+        * @since 1.22
+        */
+       public function isTOCEnabled() {
+               return $this->mEnableTOC;
+       }
  }
@@@ -115,6 -115,10 +115,10 @@@ class Parser 
        # Marker Suffix needs to be accessible staticly.
        const MARKER_SUFFIX = "-QINU\x7f";
  
+       # Markers used for wrapping the table of contents
+       const TOC_START = '<mw:toc>';
+       const TOC_END = '</mw:toc>';
        # Persistent:
        var $mTagHooks = array();
        var $mTransparentTagHooks = array();
                                }
                        }
  
 -                      # Self-link checking
 -                      if ( $nt->getFragment() === '' && $ns != NS_SPECIAL ) {
 -                              if ( $nt->equals( $this->mTitle ) || ( !$nt->isKnown() && in_array(
 -                                      $this->mTitle->getPrefixedText(),
 -                                      $this->getConverterLanguage()->autoConvertToAllVariants( $nt->getPrefixedText() ),
 -                                      true
 -                              ) ) ) {
 -                                      $s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
 -                                      continue;
 -                              }
 +                      # Self-link checking. For some languages, variants of the title are checked in
 +                      # LinkHolderArray::doVariants() to allow batching the existence checks necessary
 +                      # for linking to a different variant.
 +                      if ( $ns != NS_SPECIAL && $nt->equals( $this->mTitle ) && $nt->getFragment() === '' ) {
 +                              $s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
 +                              continue;
                        }
  
                        # NS_MEDIA is a pseudo-namespace for linking directly to a file
                $result = $this->closeParagraph();
  
                if ( '*' === $char ) {
 -                      $result .= '<ul><li>';
 +                      $result .= "<ul>\n<li>";
                } elseif ( '#' === $char ) {
 -                      $result .= '<ol><li>';
 +                      $result .= "<ol>\n<li>";
                } elseif ( ':' === $char ) {
 -                      $result .= '<dl><dd>';
 +                      $result .= "<dl>\n<dd>";
                } elseif ( ';' === $char ) {
 -                      $result .= '<dl><dt>';
 +                      $result .= "<dl>\n<dt>";
                        $this->mDTopen = true;
                } else {
                        $result = '<!-- ERR 1 -->';
         */
        function nextItem( $char ) {
                if ( '*' === $char || '#' === $char ) {
 -                      return '</li><li>';
 +                      return "</li>\n<li>";
                } elseif ( ':' === $char || ';' === $char ) {
 -                      $close = '</dd>';
 +                      $close = "</dd>\n";
                        if ( $this->mDTopen ) {
 -                              $close = '</dt>';
 +                              $close = "</dt>\n";
                        }
                        if ( ';' === $char ) {
                                $this->mDTopen = true;
         */
        function closeList( $char ) {
                if ( '*' === $char ) {
 -                      $text = '</li></ul>';
 +                      $text = "</li>\n</ul>";
                } elseif ( '#' === $char ) {
 -                      $text = '</li></ol>';
 +                      $text = "</li>\n</ol>";
                } elseif ( ':' === $char ) {
                        if ( $this->mDTopen ) {
                                $this->mDTopen = false;
 -                              $text = '</dt></dl>';
 +                              $text = "</dt>\n</dl>";
                        } else {
 -                              $text = '</dd></dl>';
 +                              $text = "</dd>\n</dl>";
                        }
                } else {
                        return '<!-- ERR 3 -->';
                                $openmatch = preg_match( '/(?:<table|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
                                $closematch = preg_match(
                                        '/(?:<\\/table|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|' .
-                                       '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|' . $this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
+                                       '<td|<th|<\\/?blockquote|<\\/?div|<hr|<\\/pre|<\\/p|<\\/mw:|' . $this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
                                if ( $openmatch or $closematch ) {
                                        $paragraphStack = false;
                                        # TODO bug 5718: paragraph closed
                        }
                        $toc = Linker::tocList( $toc, $this->mOptions->getUserLangObj() );
                        $this->mOutput->setTOCHTML( $toc );
+                       $toc = self::TOC_START . $toc . self::TOC_END;
                }
  
                if ( $isMain ) {
   */
  class ParserTest {
        /**
 -       * boolean $color whereas output should be colorized
 +       * @var bool $color whereas output should be colorized
         */
        private $color;
  
        /**
 -       * boolean $showOutput Show test output
 +       * @var bool $showOutput Show test output
         */
        private $showOutput;
  
        /**
 -       * boolean $useTemporaryTables Use temporary tables for the temporary database
 +       * @var bool $useTemporaryTables Use temporary tables for the temporary database
         */
        private $useTemporaryTables = true;
  
        /**
 -       * boolean $databaseSetupDone True if the database has been set up
 +       * @var bool $databaseSetupDone True if the database has been set up
         */
        private $databaseSetupDone = false;
  
@@@ -65,7 -65,7 +65,7 @@@
        private $dbClone;
  
        /**
 -       * string $oldTablePrefix Original table prefix
 +       * @var string $oldTablePrefix Original table prefix
         */
        private $oldTablePrefix;
  
  
        /**
         * Get a Parser object
+        *
+        * @param string $preprocessor
+        * @return Parser
         */
        function getParser( $preprocessor = null ) {
                global $wgParserConf;
                        $out = $parser->getPreloadText( $input, $title, $options );
                } else {
                        $output = $parser->parse( $input, $title, $options, true, true, 1337 );
+                       $output->setTOCEnabled( !isset( $opts['notoc'] ) );
                        $out = $output->getText();
  
                        if ( isset( $opts['showtitle'] ) ) {
        /**
         * Use a regex to find out the value of an option
         * @param $key String: name of option val to retrieve
-        * @param $opts Options array to look in
+        * @param $opts array: Options array to look in
         * @param $default Mixed: default value returned if not found
         */
        private static function getOptionValue( $key, $opts, $default ) {
@@@ -26,6 -26,7 +26,7 @@@
  # showtitle     make the first line the title
  # comment       run through Linker::formatComment() instead of main parser
  # local         format section links in edit comment text as local links
+ # notoc         disable table of contents
  #
  # You can also set the following parser properties via test options:
  #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
@@@ -403,12 -404,9 +404,12 @@@ Simple lis
  * Item 1
  * Item 2
  !! result
 -<ul><li> Item 1
 -</li><li> Item 2
 -</li></ul>
 +<ul>
 +<li> Item 1
 +</li>
 +<li> Item 2
 +</li>
 +</ul>
  
  !! end
  
@@@ -431,38 -429,22 +432,38 @@@ Italics and bol
  * plain l'''italic''plain
  * plain l''''bold''' plain
  !! result
 -<ul><li> plain
 -</li><li> plain<i>italic</i>plain
 -</li><li> plain<i>italic</i>plain<i>italic</i>plain
 -</li><li> plain<b>bold</b>plain
 -</li><li> plain<b>bold</b>plain<b>bold</b>plain
 -</li><li> plain<i>italic</i>plain<b>bold</b>plain
 -</li><li> plain<b>bold</b>plain<i>italic</i>plain
 -</li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
 -</li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
 -</li><li> plain<i><b>bold-italic</b>italic</i>plain
 -</li><li> plain<b><i>bold-italic</i>bold</b>plain
 -</li><li> plain<i>italic<b>bold-italic</b></i>plain
 -</li><li> plain<b>bold<i>bold-italic</i></b>plain
 -</li><li> plain l'<i>italic</i>plain
 -</li><li> plain l'<b>bold</b> plain
 -</li></ul>
 +<ul>
 +<li> plain
 +</li>
 +<li> plain<i>italic</i>plain
 +</li>
 +<li> plain<i>italic</i>plain<i>italic</i>plain
 +</li>
 +<li> plain<b>bold</b>plain
 +</li>
 +<li> plain<b>bold</b>plain<b>bold</b>plain
 +</li>
 +<li> plain<i>italic</i>plain<b>bold</b>plain
 +</li>
 +<li> plain<b>bold</b>plain<i>italic</i>plain
 +</li>
 +<li> plain<i>italic<b>bold-italic</b>italic</i>plain
 +</li>
 +<li> plain<b>bold<i>bold-italic</i>bold</b>plain
 +</li>
 +<li> plain<i><b>bold-italic</b>italic</i>plain
 +</li>
 +<li> plain<b><i>bold-italic</i>bold</b>plain
 +</li>
 +<li> plain<i>italic<b>bold-italic</b></i>plain
 +</li>
 +<li> plain<b>bold<i>bold-italic</i></b>plain
 +</li>
 +<li> plain l'<i>italic</i>plain
 +</li>
 +<li> plain l'<b>bold</b> plain
 +</li>
 +</ul>
  
  !! end
  
@@@ -1004,24 -986,15 +1005,24 @@@ nowiki 
  *There is not nowiki.
  *There is <nowiki>nowiki</nowiki>.
  !! result
 -<dl><dd>There is not nowiki.
 -</dd><dd>There is nowiki.
 -</dd></dl>
 -<ol><li>There is not nowiki.
 -</li><li>There is nowiki.
 -</li></ol>
 -<ul><li>There is not nowiki.
 -</li><li>There is nowiki.
 -</li></ul>
 +<dl>
 +<dd>There is not nowiki.
 +</dd>
 +<dd>There is nowiki.
 +</dd>
 +</dl>
 +<ol>
 +<li>There is not nowiki.
 +</li>
 +<li>There is nowiki.
 +</li>
 +</ol>
 +<ul>
 +<li>There is not nowiki.
 +</li>
 +<li>There is nowiki.
 +</li>
 +</ul>
  
  !! end
  
@@@ -1775,10 -1748,8 +1776,10 @@@ Templates: Strip leading and trailing w
  </p><p>b
  </p><p>c
  </p>
 -<ul><li> d
 -</li></ul>
 +<ul>
 +<li> d
 +</li>
 +</ul>
  
  !! end
  
@@@ -1819,10 -1790,8 +1820,10 @@@ Templates: Don't strip whitespace from 
  </pre>
  <p><br />
  </p>
 -<ul><li> f
 -</li></ul>
 +<ul>
 +<li> f
 +</li>
 +</ul>
  <p><br />
  </p>
  <pre>g
@@@ -2272,11 -2241,8 +2273,11 @@@ Simple definitio
  !! input
  ; name : Definition
  !! result
 -<dl><dt> name&#160;</dt><dd> Definition
 -</dd></dl>
 +<dl>
 +<dt> name&#160;</dt>
 +<dd> Definition
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2285,10 -2251,8 +2286,10 @@@ Definition list for indentation onl
  !! input
  : Indented text
  !! result
 -<dl><dd> Indented text
 -</dd></dl>
 +<dl>
 +<dd> Indented text
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2297,11 -2261,8 +2298,11 @@@ Definition list with no spac
  !! input
  ;name:Definition
  !! result
 -<dl><dt>name</dt><dd>Definition
 -</dd></dl>
 +<dl>
 +<dt>name</dt>
 +<dd>Definition
 +</dd>
 +</dl>
  
  !!end
  
@@@ -2310,11 -2271,8 +2311,11 @@@ Definition list with URL lin
  !! input
  ; http://example.com/ : definition
  !! result
 -<dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
 -</dd></dl>
 +<dl>
 +<dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
 +<dd> definition
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2323,11 -2281,8 +2324,11 @@@ Definition list with bracketed URL lin
  !! input
  ;[http://www.example.com/ Example]:Something about it
  !! result
 -<dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
 -</dd></dl>
 +<dl>
 +<dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
 +<dd>Something about it
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2336,11 -2291,8 +2337,11 @@@ Definition list with wikilink containin
  !! input
  ; [[Help:FAQ]]: The least-read page on Wikipedia
  !! result
 -<dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
 -</dd></dl>
 +<dl>
 +<dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
 +<dd> The least-read page on Wikipedia
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2350,11 -2302,8 +2351,11 @@@ Definition list with news link containi
  !! input
  ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
  !! result
 -<dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
 -</dd></dl>
 +<dl>
 +<dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
 +<dd> This isn't even a real newsgroup!
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2363,10 -2312,8 +2364,10 @@@ Malformed definition list with colo
  !! input
  ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
  !! result
 -<dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
 -</dt></dl>
 +<dl>
 +<dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
 +</dt>
 +</dl>
  
  !! end
  
@@@ -2375,11 -2322,8 +2376,11 @@@ Definition lists: colon in external lin
  !! input
  ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
  !! result
 -<dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
 -</dd></dl>
 +<dl>
 +<dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
 +<dd> OK, I made that up
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2388,10 -2332,8 +2389,10 @@@ Definition lists: colon in HTML attribu
  !! input
  ;<b style="display: inline">bold</b>
  !! result
 -<dl><dt><b style="display: inline">bold</b>
 -</dt></dl>
 +<dl>
 +<dt><b style="display: inline">bold</b>
 +</dt>
 +</dl>
  
  !! end
  
@@@ -2400,11 -2342,8 +2401,11 @@@ Definition lists: self-closed ta
  !! input
  ;one<br/>two : two-line fun
  !! result
 -<dl><dt>one<br />two&#160;</dt><dd> two-line fun
 -</dd></dl>
 +<dl>
 +<dt>one<br />two&#160;</dt>
 +<dd> two-line fun
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2433,19 -2372,16 +2434,19 @@@ Definition and unordered list using wik
  <ul><li>
  ; term : description
  * unordered
 -</li>
 -</ul>
 +</li></ul>
  !! result
  <ul><li>
 -<dl><dt> term&#160;</dt><dd> description
 -</dd></dl>
 -<ul><li> unordered
 -</li></ul>
 +<dl>
 +<dt> term&#160;</dt>
 +<dd> description
 +</dd>
 +</dl>
 +<ul>
 +<li> unordered
  </li>
  </ul>
 +</li></ul>
  
  !! end
  
@@@ -2456,11 -2392,8 +2457,11 @@@ Definition list with empty definition a
  ; term:
  Paragraph text
  !! result
 -<dl><dt> term</dt><dd>
 -</dd></dl>
 +<dl>
 +<dt> term</dt>
 +<dd>
 +</dd>
 +</dl>
  <p>Paragraph text
  </p>
  !! end
@@@ -2489,14 -2422,10 +2490,14 @@@ Definition Lists: No nesting: Multiple 
  :a
  :b
  !! result
 -<dl><dt>x
 -</dt><dd>a
 -</dd><dd>b
 -</dd></dl>
 +<dl>
 +<dt>x
 +</dt>
 +<dd>a
 +</dd>
 +<dd>b
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2507,18 -2436,12 +2508,18 @@@ Definition Lists: Indentation: Regula
  ::i2
  :::i3
  !! result
 -<dl><dd>i1
 -<dl><dd>i2
 -<dl><dd>i3
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 +<dl>
 +<dd>i1
 +<dl>
 +<dd>i2
 +<dl>
 +<dd>i3
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2528,17 -2451,11 +2529,17 @@@ Definition Lists: Indentation: Missing 
  ::i2
  :::i3
  !! result
 -<dl><dd><dl><dd>i2
 -<dl><dd>i3
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 +<dl>
 +<dd><dl>
 +<dd>i2
 +<dl>
 +<dd>i3
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2547,16 -2464,10 +2548,16 @@@ Definition Lists: Indentation: Multi-le
  !! input
  :::i3
  !! result
 -<dl><dd><dl><dd><dl><dd>i3
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 +<dl>
 +<dd><dl>
 +<dd><dl>
 +<dd>i3
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2591,9 -2502,7 +2592,9 @@@ parsoi
  |a
  |} 
  !! result
 -<dl><dd> <table><tr><td>a</td></tr></table> </dd></dl>
 +<dl>
 +<dd> <table><tr><td>a</td></tr></table> </dd>
 +</dl>
  !! end
  ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
  ## as an empty dt item.  It also ignores all but the last ";" when followed
@@@ -2646,17 -2555,13 +2647,17 @@@ Table / list interaction: indented tabl
  
  <tr>
  <td> a
 -<ul><li> b
 -</li></ul>
 +<ul>
 +<li> b
 +</li>
 +</ul>
  </td></tr>
  <tr>
  <td> c
 -<ul><li> d
 -</li></ul>
 +<ul>
 +<li> d
 +</li>
 +</ul>
  </td></tr></table></dd></dl>
  
  !! end
@@@ -2679,27 -2584,18 +2680,27 @@@ Table / list interaction: lists nested 
  <dl><dd><table>
  <tr>
  <td>
 -<dl><dd>a
 -</dd><dd>b
 -</dd></dl>
 +<dl>
 +<dd>a
 +</dd>
 +<dd>b
 +</dd>
 +</dl>
  </td>
  <td>
 -<ul><li>c
 -</li><li>d
 -</li></ul>
 +<ul>
 +<li>c
 +</li>
 +<li>d
 +</li>
 +</ul>
  </td></tr></table></dd></dl>
 -<ul><li>e
 -</li><li>f
 -</li></ul>
 +<ul>
 +<li>e
 +</li>
 +<li>f
 +</li>
 +</ul>
  
  !!end
  
@@@ -2787,18 -2683,11 +2788,18 @@@ Definition Lists: Nesting: Test 
  ::;t3
  :::d3
  !! result
 -<dl><dd><dl><dd><dl><dt>t3
 -</dt><dd>d3
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 +<dl>
 +<dd><dl>
 +<dd><dl>
 +<dt>t3
 +</dt>
 +<dd>d3
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  
  ::* bar
  :; baz
  !! result
 -<dl><dd><dl><dt><ul><li> foo
 -</li><li> bar
 -</li></ul>
 -</dt></dl>
 -<dl><dt> baz
 -</dt></dl>
 -</dd></dl>
 +<dl>
 +<dd><dl>
 +<dt><ul>
 +<li> foo
 +</li>
 +<li> bar
 +</li>
 +</ul>
 +</dt>
 +</dl>
 +<dl>
 +<dt> baz
 +</dt>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  !! test
@@@ -2842,19 -2722,9 +2843,19 @@@ parsoi
  ::* bar
  :; baz
  !! result
 -<dl><dd><dl><dt><ul><li> foo
 -</li></ul></dt><dd><ul><li> bar
 -</li></ul></dd><dt> baz</dt></dl></dd></dl>
 +<dl>
 +<dd><dl>
 +<dt><ul>
 +<li> foo
 +</li>
 +</ul></dt>
 +<dd><ul>
 +<li> bar
 +</li>
 +</ul></dd>
 +<dt> baz</dt>
 +</dl></dd>
 +</dl>
  !! end
  
  !! test
@@@ -2863,15 -2733,10 +2864,15 @@@ Definition Lists: Mixed Lists: Test 
  *: d1
  *: d2
  !! result
 -<ul><li><dl><dd> d1
 -</dd><dd> d2
 -</dd></dl>
 -</li></ul>
 +<ul>
 +<li><dl>
 +<dd> d1
 +</dd>
 +<dd> d2
 +</dd>
 +</dl>
 +</li>
 +</ul>
  
  !! end
  
@@@ -2882,21 -2747,12 +2883,21 @@@ Definition Lists: Mixed Lists: Test 
  *::: d1
  *::: d2
  !! result
 -<ul><li><dl><dd><dl><dd><dl><dd> d1
 -</dd><dd> d2
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 -</li></ul>
 +<ul>
 +<li><dl>
 +<dd><dl>
 +<dd><dl>
 +<dd> d1
 +</dd>
 +<dd> d2
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</li>
 +</ul>
  
  !! end
  
@@@ -2907,17 -2763,10 +2908,17 @@@ Definition Lists: Mixed Lists: Test 
  *;d1 :d2
  *;d3 :d4
  !! result
 -<ul><li><dl><dt>d1&#160;</dt><dd>d2
 -</dd><dt>d3&#160;</dt><dd>d4
 -</dd></dl>
 -</li></ul>
 +<ul>
 +<li><dl>
 +<dt>d1&#160;</dt>
 +<dd>d2
 +</dd>
 +<dt>d3&#160;</dt>
 +<dd>d4
 +</dd>
 +</dl>
 +</li>
 +</ul>
  
  !! end
  
@@@ -2928,17 -2777,11 +2929,17 @@@ Definition Lists: Mixed Lists: Test 
  *:d1
  *:: d2
  !! result
 -<ul><li><dl><dd>d1
 -<dl><dd> d2
 -</dd></dl>
 -</dd></dl>
 -</li></ul>
 +<ul>
 +<li><dl>
 +<dd>d1
 +<dl>
 +<dd> d2
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</li>
 +</ul>
  
  !! end
  
@@@ -2949,23 -2792,13 +2950,23 @@@ Definition Lists: Mixed Lists: Test 
  #*:d1
  #*::: d3
  !! result
 -<ol><li><ul><li><dl><dd>d1
 -<dl><dd><dl><dd> d3
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 -</li></ul>
 -</li></ol>
 +<ol>
 +<li><ul>
 +<li><dl>
 +<dd>d1
 +<dl>
 +<dd><dl>
 +<dd> d3
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</li>
 +</ul>
 +</li>
 +</ol>
  
  !! end
  
@@@ -2976,15 -2809,10 +2977,15 @@@ Definition Lists: Mixed Lists: Test 
  :* d1
  :* d2
  !! result
 -<dl><dd><ul><li> d1
 -</li><li> d2
 -</li></ul>
 -</dd></dl>
 +<dl>
 +<dd><ul>
 +<li> d1
 +</li>
 +<li> d2
 +</li>
 +</ul>
 +</dd>
 +</dl>
  
  !! end
  
@@@ -2995,20 -2823,12 +2996,20 @@@ Definition Lists: Mixed Lists: Test 
  :* d1
  ::* d2
  !! result
 -<dl><dd><ul><li> d1
 -</li></ul>
 -<dl><dd><ul><li> d2
 -</li></ul>
 -</dd></dl>
 -</dd></dl>
 +<dl>
 +<dd><ul>
 +<li> d1
 +</li>
 +</ul>
 +<dl>
 +<dd><ul>
 +<li> d2
 +</li>
 +</ul>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
  
  !! end
  
@@@ -3018,14 -2838,9 +3019,14 @@@ Definition Lists: Mixed Lists: Test 
  !! input
  *;foo :bar
  !! result
 -<ul><li><dl><dt>foo&#160;</dt><dd>bar
 -</dd></dl>
 -</li></ul>
 +<ul>
 +<li><dl>
 +<dt>foo&#160;</dt>
 +<dd>bar
 +</dd>
 +</dl>
 +</li>
 +</ul>
  
  !! end
  
@@@ -3035,17 -2850,10 +3036,17 @@@ Definition Lists: Mixed Lists: Test 1
  !! input
  *#;foo :bar
  !! result
 -<ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
 -</dd></dl>
 -</li></ol>
 -</li></ul>
 +<ul>
 +<li><ol>
 +<li><dl>
 +<dt>foo&#160;</dt>
 +<dd>bar
 +</dd>
 +</dl>
 +</li>
 +</ol>
 +</li>
 +</ul>
  
  !! end
  
  *#*#;*;;foo :bar
  *#*#;boo :baz
  !! result
 -<ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
 -</dt></dl>
 -</dd></dl>
 -</li></ul>
 -</dd></dl>
 -<dl><dt>boo&#160;</dt><dd>baz
 -</dd></dl>
 -</li></ol>
 -</li></ul>
 -</li></ol>
 -</li></ul>
 +<ul>
 +<li><ol>
 +<li><ul>
 +<li><ol>
 +<li><dl>
 +<dt>foo&#160;</dt>
 +<dd><ul>
 +<li><dl>
 +<dt><dl>
 +<dt>bar
 +</dt>
 +</dl>
 +</dd>
 +</dl>
 +</li>
 +</ul>
 +</dd>
 +</dl>
 +<dl>
 +<dt>boo&#160;</dt>
 +<dd>baz
 +</dd>
 +</dl>
 +</li>
 +</ol>
 +</li>
 +</ul>
 +</li>
 +</ol>
 +</li>
 +</ul>
  
  !! end
  !! test
@@@ -3119,17 -2907,9 +3120,17 @@@ parsoi
  <dt>
  <dl>
  <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
 -<dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
 +<dd data-parsoid='{"stx":"row"}'>bar</dd>
 +</dl></dt>
 +</dl></li>
 +</ul></dt>
  <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
 -<dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
 +<dd data-parsoid='{"stx":"row"}'>baz</dd>
 +</dl></li>
 +</ol></li>
 +</ul></li>
 +</ol></li>
 +</ul>
  !! end
  
  
  !! input
  *#;*::;; foo : bar (who uses this?)
  !! result
 -<ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
 -</dt></dl>
 -</dd></dl>
 -</dd></dl>
 -</dd></dl>
 -</li></ul>
 -</dd></dl>
 -</li></ol>
 -</li></ul>
 +<ul>
 +<li><ol>
 +<li><dl>
 +<dt> foo&#160;</dt>
 +<dd><ul>
 +<li><dl>
 +<dd><dl>
 +<dd><dl>
 +<dt><dl>
 +<dt> bar (who uses this?)
 +</dt>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</li>
 +</ul>
 +</dd>
 +</dl>
 +</li>
 +</ol>
 +</li>
 +</ul>
  
  !! end
  !! test
@@@ -3191,15 -2954,7 +3192,15 @@@ parsoi
  <dt>
  <dl>
  <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
 -<dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
 +<dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
 +</dl></dt>
 +</dl></dd>
 +</dl></dd>
 +</dl></li>
 +</ul></dt>
 +</dl></li>
 +</ol></li>
 +</ul>
  !! end
  
  ###
@@@ -4673,9 -4428,7 +4674,9 @@@ parsoid=wt2html,wt2w
  !! result
  <table>
  <tr>
 -<td><ul><li>a</li></ul></td>
 +<td><ul>
 +<li>a</li>
 +</ul></td>
  </tr>
  </table>
  !! end
@@@ -5359,12 -5112,9 +5360,12 @@@ Interwiki link encoding conversion (bu
  *[[Wikipedia:ro:Olteni&#0355;a]]
  *[[Wikipedia:ro:Olteni&#355;a]]
  !! result
 -<ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
 -</li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
 -</li></ul>
 +<ul>
 +<li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
 +</li>
 +<li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
 +</li>
 +</ul>
  
  !! end
  
@@@ -5792,14 -5542,10 +5793,14 @@@ Common lis
  * item 2
  *item 3
  !! result
 -<ul><li>Common list
 -</li><li> item 2
 -</li><li>item 3
 -</li></ul>
 +<ul>
 +<li>Common list
 +</li>
 +<li> item 2
 +</li>
 +<li>item 3
 +</li>
 +</ul>
  
  !! end
  
@@@ -5810,14 -5556,10 +5811,14 @@@ Numbered lis
  #item 2
  # item 3
  !! result
 -<ol><li>Numbered list
 -</li><li>item 2
 -</li><li> item 3
 -</li></ol>
 +<ol>
 +<li>Numbered list
 +</li>
 +<li>item 2
 +</li>
 +<li> item 3
 +</li>
 +</ol>
  
  !! end
  
@@@ -5840,67 -5582,35 +5841,67 @@@ Mixed lis
  *** Level 3
  #** Level 3, but ordered
  !! result
 -<ul><li>Mixed list
 -<ol><li> with numbers
 -</li></ol>
 -<ul><li> and bullets
 -</li></ul>
 -<ol><li> and numbers
 -</li></ol>
 -</li><li>bullets again
 -<ul><li>bullet level 2
 -<ul><li>bullet level 3
 -<ol><li>Number on level 4
 -</li></ol>
 -</li></ul>
 -</li><li>bullet level 2
 -<ol><li>Number on level 3
 -</li><li>Number on level 3
 -</li></ol>
 -</li></ul>
 -<ol><li>number level 2
 -</li></ol>
 -</li><li>Level 1
 -<ul><li><ul><li> Level 3
 -</li></ul>
 -</li></ul>
 -</li></ul>
 -<ol><li><ul><li><ul><li> Level 3, but ordered
 -</li></ul>
 -</li></ul>
 -</li></ol>
 +<ul>
 +<li>Mixed list
 +<ol>
 +<li> with numbers
 +</li>
 +</ol>
 +<ul>
 +<li> and bullets
 +</li>
 +</ul>
 +<ol>
 +<li> and numbers
 +</li>
 +</ol>
 +</li>
 +<li>bullets again
 +<ul>
 +<li>bullet level 2
 +<ul>
 +<li>bullet level 3
 +<ol>
 +<li>Number on level 4
 +</li>
 +</ol>
 +</li>
 +</ul>
 +</li>
 +<li>bullet level 2
 +<ol>
 +<li>Number on level 3
 +</li>
 +<li>Number on level 3
 +</li>
 +</ol>
 +</li>
 +</ul>
 +<ol>
 +<li>number level 2
 +</li>
 +</ol>
 +</li>
 +<li>Level 1
 +<ul>
 +<li><ul>
 +<li> Level 3
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
 +<ol>
 +<li><ul>
 +<li><ul>
 +<li> Level 3, but ordered
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ol>
  
  !! end
  
@@@ -5910,14 -5620,10 +5911,14 @@@ Nested lists 
  *foo
  **bar
  !! result
 -<ul><li>foo
 -<ul><li>bar
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li>foo
 +<ul>
 +<li>bar
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !! end
  
@@@ -5927,15 -5633,10 +5928,15 @@@ Nested lists 
  **foo
  *bar
  !! result
 -<ul><li><ul><li>foo
 -</li></ul>
 -</li><li>bar
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li>foo
 +</li>
 +</ul>
 +</li>
 +<li>bar
 +</li>
 +</ul>
  
  !! end
  
@@@ -5945,14 -5646,10 +5946,14 @@@ Nested lists 3 (first element empty
  *
  **bar
  !! result
 -<ul><li>
 -<ul><li>bar
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li>
 +<ul>
 +<li>bar
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !! end
  
@@@ -5962,15 -5659,10 +5963,15 @@@ Nested lists 4 (first element empty
  **
  *bar
  !! result
 -<ul><li><ul><li>
 -</li></ul>
 -</li><li>bar
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li>
 +</li>
 +</ul>
 +</li>
 +<li>bar
 +</li>
 +</ul>
  
  !! end
  
@@@ -5980,15 -5672,10 +5981,15 @@@ Nested lists 5 (both elements empty
  **
  *
  !! result
 -<ul><li><ul><li>
 -</li></ul>
 -</li><li>
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li>
 +</li>
 +</ul>
 +</li>
 +<li>
 +</li>
 +</ul>
  
  !! end
  
@@@ -5998,14 -5685,10 +5999,14 @@@ Nested lists 6 (both elements empty
  *
  **
  !! result
 -<ul><li>
 -<ul><li>
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li>
 +<ul>
 +<li>
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !! end
  
@@@ -6014,16 -5697,10 +6015,16 @@@ Nested lists 7 (skip initial nesting le
  !! input
  *** foo
  !! result
 -<ul><li><ul><li><ul><li> foo
 -</li></ul>
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li><ul>
 +<li> foo
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !! end
  
@@@ -6035,21 -5712,13 +6036,21 @@@ Nested lists 8 (multiple nesting transi
  ** baz
  * boo
  !! result
 -<ul><li> foo
 -<ul><li><ul><li> bar
 -</li></ul>
 -</li><li> baz
 -</li></ul>
 -</li><li> boo
 -</li></ul>
 +<ul>
 +<li> foo
 +<ul>
 +<li><ul>
 +<li> bar
 +</li>
 +</ul>
 +</li>
 +<li> baz
 +</li>
 +</ul>
 +</li>
 +<li> boo
 +</li>
 +</ul>
  
  !! end
  
  *<!--cmt-->bar
  <!--cmt-->*baz
  !! result
 -<ul><li>foo
 -</li><li>bar
 -</li><li>baz
 -</li></ul>
 +<ul>
 +<li>foo
 +</li>
 +<li>bar
 +</li>
 +<li>baz
 +</li>
 +</ul>
  
  !! end
  
  *foo {{echo|bar
  }}*baz
  !! result
 -<ul><li>foo bar
 -</li><li>baz
 -</li></ul>
 +<ul>
 +<li>foo bar
 +</li>
 +<li>baz
 +</li>
 +</ul>
  
  !! end
  
@@@ -6093,14 -5755,10 +6094,14 @@@ List items are not parsed correctly fol
  * <pre>bar</pre>
  * zar
  !! result
 -<ul><li> <pre>foo</pre>
 -</li><li> <pre>bar</pre>
 -</li><li> zar
 -</li></ul>
 +<ul>
 +<li> <pre>foo</pre>
 +</li>
 +<li> <pre>bar</pre>
 +</li>
 +<li> zar
 +</li>
 +</ul>
  
  !! end
  
@@@ -6119,30 -5777,18 +6120,30 @@@ List items from templat
  * notSOL{{inner list}}
  * item 2
  !! result
 -<ul><li> item 1
 -</li><li> item 2
 -</li></ul>
 -<ul><li> item 0
 -</li><li> item 1
 -</li><li> item 2
 -</li></ul>
 -<ul><li> item 0
 -</li><li> notSOL
 -</li><li> item 1
 -</li><li> item 2
 -</li></ul>
 +<ul>
 +<li> item 1
 +</li>
 +<li> item 2
 +</li>
 +</ul>
 +<ul>
 +<li> item 0
 +</li>
 +<li> item 1
 +</li>
 +<li> item 2
 +</li>
 +</ul>
 +<ul>
 +<li> item 0
 +</li>
 +<li> notSOL
 +</li>
 +<li> item 1
 +</li>
 +<li> item 2
 +</li>
 +</ul>
  
  !! end
  
@@@ -6155,22 -5801,14 +6156,22 @@@ List interrupted by empty line or headi
  == A heading ==
  * Another list item
  !! result
 -<ul><li> foo
 -</li></ul>
 -<ul><li><ul><li> bar
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li> foo
 +</li>
 +</ul>
 +<ul>
 +<li><ul>
 +<li> bar
 +</li>
 +</ul>
 +</li>
 +</ul>
  <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
 -<ul><li> Another list item
 -</li></ul>
 +<ul>
 +<li> Another list item
 +</li>
 +</ul>
  
  !!end
  
@@@ -6200,16 -5838,11 +6201,16 @@@ Single-comment whitespace lines dont br
   <!--foo--> <!----> <!--This line NOT split the list either--> 
  *d
  !!result
 -<ul><li>a
 -</li><li>b
 -</li><li>c
 -</li><li>d
 -</li></ul>
 +<ul>
 +<li>a
 +</li>
 +<li>b
 +</li>
 +<li>c
 +</li>
 +<li>d
 +</li>
 +</ul>
  
  !!end
  
@@@ -6225,16 -5858,11 +6226,16 @@@ Replacing whitespace with tabs still do
          either-->      
  *d
  !!result
 -<ul><li>a
 -</li><li>b
 -</li><li>c
 -</li><li>d
 -</li></ul>
 +<ul>
 +<li>a
 +</li>
 +<li>b
 +</li>
 +<li>c
 +</li>
 +<li>d
 +</li>
 +</ul>
  
  !!end
  
@@@ -6254,17 -5882,13 +6255,17 @@@ parsoid=wt2html,wt2w
  </li>
  </ul>
  !!result
 -<ul><li> foo</li>
 +<ul>
 +<li> foo</li>
  <li>li-hack</li>
  <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
 -<li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
 +<li> <!--foo--> </li>
 +<li> li-hack with preceding comments</li>
 +</ul>
  
  <ul>
 -<li></li><li>not a li-hack
 +<li></li>
 +<li>not a li-hack
  </li>
  </ul>
  !!end
@@@ -6281,19 -5905,7 +6282,19 @@@ parsoi
  : foo
  :: bar
  !! result
 -<ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
 +<ol>
 +<li> foo<ol>
 +<li> bar</li>
 +</ol></li>
 +</ol><ul>
 +<li> foo<ul>
 +<li> bar</li>
 +</ul></li>
 +</ul><dl>
 +<dd> foo<dl>
 +<dd> bar</dd>
 +</dl></dd>
 +</dl>
  !! end
  
  !! test
@@@ -6324,14 -5936,10 +6325,14 @@@ parsoi
  *b</div>
  !! result
  <div>
 -<ul><li>a
 -</li></ul></div><div>
 -<ul><li>b
 -</li></ul></div>
 +<ul>
 +<li>a
 +</li>
 +</ul></div><div>
 +<ul>
 +<li>b
 +</li>
 +</ul></div>
  !! end
  
  !! test
@@@ -6346,12 -5954,9 +6347,12 @@@ parsoi
  !! result
  <p><span></span>
  </p>
 -<ul><li>a<span></span>
 -</li><li>b
 -</li></ul>
 +<ul>
 +<li>a<span></span>
 +</li>
 +<li>b
 +</li>
 +</ul>
  !! end
  
  !! test
@@@ -6363,12 -5968,9 +6364,12 @@@ parsoi
  # <s> a
  # b </s>
  !! result
 -<ol><li> <s> a </s>
 -</li><li> <s> b </s>
 -</li></ol>
 +<ol>
 +<li> <s> a </s>
 +</li>
 +<li> <s> b </s>
 +</li>
 +</ol>
  !! end
  
  !!test
@@@ -6560,36 -6162,21 +6561,36 @@@ Magic Words LOCAL (UTC
  * {{LOCALDOW}}
  * {{LOCALTIMESTAMP}}
  !! result
 -<ul><li> 01
 -</li><li> 1
 -</li><li> January
 -</li><li> January
 -</li><li> Jan
 -</li><li> 1
 -</li><li> 01
 -</li><li> Thursday
 -</li><li> 1970
 -</li><li> 00:02
 -</li><li> 00
 -</li><li> 1
 -</li><li> 4
 -</li><li> 19700101000203
 -</li></ul>
 +<ul>
 +<li> 01
 +</li>
 +<li> 1
 +</li>
 +<li> January
 +</li>
 +<li> January
 +</li>
 +<li> Jan
 +</li>
 +<li> 1
 +</li>
 +<li> 01
 +</li>
 +<li> Thursday
 +</li>
 +<li> 1970
 +</li>
 +<li> 00:02
 +</li>
 +<li> 00
 +</li>
 +<li> 1
 +</li>
 +<li> 4
 +</li>
 +<li> 19700101000203
 +</li>
 +</ul>
  
  !! end
  
@@@ -8389,12 -7976,9 +8390,12 @@@ unused}}}
  *{{echo|b {{nonexistent|
  unused}}}}
  !!result
 -<ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
 -</li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
 -</li></ul>
 +<ul>
 +<li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
 +</li>
 +<li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
 +</li>
 +</ul>
  
  !!end
  
@@@ -10520,6 -10104,7 +10521,7 @@@ Some tex
  </li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
@@@ -10575,6 -10160,7 +10577,7 @@@ Handling of sections up to level 6 and 
  </li>
  </ul>
  </div>
  <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
@@@ -10617,6 -10203,7 +10620,7 @@@ TOC regression (bug 9764
  </li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
@@@ -10653,6 -10240,7 +10657,7 @@@ wgMaxTocLevel=
  </li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
@@@ -10683,6 -10271,7 +10688,7 @@@ wgMaxTocLevel=
  <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
@@@ -10775,6 -10364,7 +10781,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
@@@ -10838,6 -10428,7 +10845,7 @@@ section 
  <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <p>section 1
  </p>
@@@ -10872,6 -10463,7 +10880,7 @@@ Headers with excess '=' character
  <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
  </ul>
  </div>
  <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
@@@ -10909,6 -10501,7 +10918,7 @@@ __NOEDITSECTION_
  </li>
  </ul>
  </div>
  <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
  <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
  <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
@@@ -12082,10 -11675,8 +12092,10 @@@ disable
  !! result
  <ul>
  <li>One
 -</li><li>Two
 -</li></ul>
 +</li>
 +<li>Two
 +</li>
 +</ul>
  
  !! end
  
@@@ -12116,10 -11707,8 +12126,10 @@@ disable
  !! result
  <ol>
  <li>One
 -</li><li>Two
 -</li></ol>
 +</li>
 +<li>Two
 +</li>
 +</ol>
  
  !! end
  
@@@ -12164,16 -11753,12 +12174,16 @@@ disable
  !! result
  <ul>
  <li>One
 -</li><li>Two:
 +</li>
 +<li>Two:
  <ul>
  <li>Sub-one
 -</li><li>Sub-two
 -</li></ul>
 -</li></ul>
 +</li>
 +<li>Sub-two
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !! end
  
@@@ -12218,27 -11803,21 +12228,27 @@@ disable
  !! result
  <ol>
  <li>One
 -</li><li>Two:
 +</li>
 +<li>Two:
  <ol>
  <li>Sub-one
 -</li><li>Sub-two
 -</li></ol>
 -</li></ol>
 +</li>
 +<li>Sub-two
 +</li>
 +</ol>
 +</li>
 +</ol>
  
  !! end
  
  !! test
  HTML ordered list item with parameters oddity
  !! input
 -<ol><li id="fragment">One</li></ol>
 +<ol><li id="fragment">One</li>
 +</ol>
  !! result
 -<ol><li id="fragment">One</li></ol>
 +<ol><li id="fragment">One</li>
 +</ol>
  
  !! end
  
@@@ -12297,6 -11876,7 +12307,7 @@@ http://<div id="toc" class="toc"><div i
  </ul>
  </div>
  
  !! end
  
  !! test
@@@ -13462,13 -13042,9 +13473,13 @@@ Handling of &#x0A; in URL
  !! input
  **irc://&#x0A;a
  !! result
 -<ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
 -</li></ul>
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
 +</li>
 +</ul>
 +</li>
 +</ul>
  
  !!end
  
@@@ -13528,52 -13104,29 +13539,52 @@@ title=[[Parser test]
  * {{SUBJECTSPACEE}}
  * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
  !! result
 -<ul><li> Parser test
 -</li><li> Parser_test
 -</li><li> Parser test
 -</li><li> Parser_test
 -</li><li> Parser test
 -</li><li> Parser_test
 -</li><li> Parser test
 -</li><li> Parser_test
 -</li><li> Parser test
 -</li><li> Parser_test
 -</li><li> Talk:Parser test
 -</li><li> Talk:Parser_test
 -</li><li> Parser test
 -</li><li> Parser_test
 -</li><li> 
 -</li><li> 
 -</li><li> 0
 -</li><li> Talk
 -</li><li> Talk
 -</li><li> 
 -</li><li> 
 -</li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
 -</li></ul>
 +<ul>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> Talk:Parser test
 +</li>
 +<li> Talk:Parser_test
 +</li>
 +<li> Parser test
 +</li>
 +<li> Parser_test
 +</li>
 +<li> 
 +</li>
 +<li> 
 +</li>
 +<li> 0
 +</li>
 +<li> Talk
 +</li>
 +<li> Talk
 +</li>
 +<li> 
 +</li>
 +<li> 
 +</li>
 +<li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
 +</li>
 +</ul>
  
  !! end
  ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
@@@ -13961,25 -13514,13 +13972,25 @@@ disable
  !! input
  :;;;::
  !! result
 -<dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
 -</dd></dl>
 -</dd></dl>
 -</dt></dl>
 -</dt></dl>
 -</dt></dl>
 -</dd></dl>
 +<dl>
 +<dd><dl>
 +<dt><dl>
 +<dt><dl>
 +<dt><dl>
 +<dd><dl>
 +<dd>
 +</dd>
 +</dl>
 +</dd>
 +</dl>
 +</dt>
 +</dl>
 +</dt>
 +</dl>
 +</dt>
 +</dl>
 +</dd>
 +</dl>
  
  !!end
  
@@@ -14121,17 -13662,10 +14132,17 @@@ Definition list code coverag
  ; title : def
  ;title: def
  !! result
 -<dl><dt> title  &#160;</dt><dd> def
 -</dd><dt> title&#160;</dt><dd> def
 -</dd><dt>title</dt><dd> def
 -</dd></dl>
 +<dl>
 +<dt> title  &#160;</dt>
 +<dd> def
 +</dd>
 +<dt> title&#160;</dt>
 +<dd> def
 +</dd>
 +<dt>title</dt>
 +<dd> def
 +</dd>
 +</dl>
  
  !! end
  
@@@ -14226,6 -13760,7 +14237,7 @@@ Out-of-order TOC heading level
  </li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
@@@ -14438,17 -13973,6 +14450,17 @@@ title=[[Duna]] language=s
  </p>
  !! end
  
 +!! test
 +Link to a section of a variant of this title shouldn't be parsed as self-link
 +!! options
 +title=[[Duna]] language=sr
 +!! input
 +[[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
 +!! result
 +<p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
 +</p>
 +!! end
 +
  !! test
  Link to pages in language variants
  !! options
@@@ -14818,12 -14342,9 +14830,12 @@@ Bug 529: Uncovered bulle
  !! input
  * Foo {{bullet}}
  !! result
 -<ul><li> Foo 
 -</li><li> Bar
 -</li></ul>
 +<ul>
 +<li> Foo 
 +</li>
 +<li> Bar
 +</li>
 +</ul>
  
  !! end
  
@@@ -14838,30 -14359,15 +14850,30 @@@ Bug 529: Uncovered bullet leaving empt
  !! input
  ******* Foo {{bullet}}
  !! result
 -<ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
 -</li></ul>
 -</li></ul>
 -</li></ul>
 -</li></ul>
 -</li></ul>
 -</li></ul>
 -</li><li> Bar
 -</li></ul>
 +<ul>
 +<li><ul>
 +<li><ul>
 +<li><ul>
 +<li><ul>
 +<li><ul>
 +<li><ul>
 +<li> Foo 
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +</ul>
 +</li>
 +<li> Bar
 +</li>
 +</ul>
  
  !! end
  
@@@ -14893,12 -14399,9 +14905,12 @@@ Bug 529: Uncovered bullet in parser fun
  !! input
  * Foo {{lc:{{bullet}} }}
  !! result
 -<ul><li> Foo 
 -</li><li> bar
 -</li></ul>
 +<ul>
 +<li> Foo 
 +</li>
 +<li> bar
 +</li>
 +</ul>
  
  !! end
  
@@@ -15824,6 -15327,7 +15836,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! end
@@@ -15841,6 -15345,7 +15854,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! end
@@@ -15858,6 -15363,7 +15872,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! end
@@@ -15875,6 -15381,7 +15890,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
  !! end
  <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <p><small>Hanc marginis exiguitas non caperet.</small>
  QED
@@@ -15914,6 -15422,7 +15931,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
@@@ -15933,6 -15442,7 +15951,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  
@@@ -15961,6 -15471,7 +15980,7 @@@ __TOC_
  <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
  </ul>
  </div>
  <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
@@@ -16250,6 -15761,29 +16270,29 @@@ HttP://MediaWiki.Org
  </p>
  !! end
  
+ !!test
+ Disable TOC
+ !! options
+ notoc
+ !! input
+ Lead
+ == Section 1 ==
+ == Section 2 ==
+ == Section 3 ==
+ == Section 4 ==
+ == Section 5 ==
+ !! result
+ <p>Lead
+ </p>
+ <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+ <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+ <h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+ <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+ <h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
+ !! end
  
  ###
  ### Parsoids-specific tests
@@@ -16265,14 -15799,11 +16308,14 @@@ parsoid=wt2html,wt2w
  {{echo|:a}}
  !!result
  <span about="#mwt1" typeof="mw:Transclusion">
 -</span><ul about="#mwt1"><li>a</li></ul>
 +</span><ul about="#mwt1"><li>a</li>
 +</ul>
  <span about="#mwt2" typeof="mw:Transclusion">
 -</span><ol about="#mwt2"><li>a</li></ol>
 +</span><ol about="#mwt2"><li>a</li>
 +</ol>
  <span about="#mwt3" typeof="mw:Transclusion">
 -</span><dl about="#mwt3"><dd>a</dd></dl>
 +</span><dl about="#mwt3"><dd>a</dd>
 +</dl>
  !!end
  
  #### ----------------------------------------------------------------
@@@ -16347,8 -15878,7 +16390,8 @@@ A <ref
  
  <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'>
  <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
 -</li></ol>
 +</li>
 +</ol>
  !!end
  
  !!test
@@@ -16370,8 -15900,7 +16413,8 @@@ A <ref
  <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
   bar
   baz
 -</li></ol>
 +</li>
 +</ol>
  !!end
  
  !!test
  
  
  booz
 -</li></ol>
 +</li>
 +</ol>
  !!end
  
  !!test
@@@ -16423,8 -15951,7 +16466,8 @@@ A <ref> foo {{echo|</ref> B C}
  <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,0,0]}\">{{</span>echo|"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
  
  <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
 -<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
 +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
 +</ol>
  !!end
  
  !!test
@@@ -16439,8 -15966,7 +16482,8 @@@ A <ref> foo <!--</ref> B 
  <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
  
  <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
 -<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
 +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
 +</ol>
  !!end
  
  !!test
@@@ -16455,8 -15981,7 +16498,8 @@@ A <ref> <b> foo </ref> B 
  <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
  
  <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
 -<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
 +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li>
 +</ol>
  !!end
  
  !!test
@@@ -16518,8 -16043,7 +16561,8 @@@ parsoi
  <p><span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
  
  <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
 -<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
 +<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li>
 +</ol>
  !!end
  
  !!test
@@@ -16535,8 -16059,7 +16578,8 @@@ B1 <ref name="b" /> B2 <ref name="b">ba
  <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
  B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
  
 -<ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
 +<ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li>
 +</ol>
  !!end
  
  !!test
@@@ -16562,8 -16085,7 +16605,8 @@@ B <ref group="b">bar</ref
  <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
  B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
  
 -<ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
 +<ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
 +</ol>
  !!end
  
  !!test
@@@ -16581,13 -16103,11 +16624,13 @@@ B <ref>bar</ref
  !!result
  <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
  
 -<ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
 +<ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
 +</ol>
  
  <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
  
 -<ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
 +<ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li>
 +</ol>
  !!end
  
  !!test
@@@ -16607,13 -16127,11 +16650,13 @@@ C <ref>cfoo</ref
  <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
  B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
  
 -<ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
 +<ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li>
 +</ol>
  
  <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
  
 -<ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
 +<ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li>
 +</ol>
  !!end
  
  !!test
@@@ -16632,8 -16150,7 +16675,8 @@@ This should just get lost
  <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
  B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
  
 -<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"\n<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
 +<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"\n<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
 +</ol>
  !!end
  
  !!test
@@@ -16665,12 -16182,10 +16708,12 @@@ B <span about="#mwt4" class="reference
  
  <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
  <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li>
 -<li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li></ol>
 +<li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> </li>
 +</ol>
  
  <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'>
 -<li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
 +<li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li>
 +</ol>
  !! end
  
  #### ----------------------------------------------------------------
@@@ -16966,38 -16481,22 +17009,38 @@@ Lists: 1. Nested inside htm
  
  #<nowiki>;foo</nowiki>
  !! result
 -<ul><li>*foo
 -</li></ul>
 -<ul><li>#foo
 -</li></ul>
 -<ul><li>:foo
 -</li></ul>
 -<ul><li>;foo
 -</li></ul>
 -<ol><li>*foo
 -</li></ol>
 -<ol><li>#foo
 -</li></ol>
 -<ol><li>:foo
 -</li></ol>
 -<ol><li>;foo
 -</li></ol>
 +<ul>
 +<li>*foo
 +</li>
 +</ul>
 +<ul>
 +<li>#foo
 +</li>
 +</ul>
 +<ul>
 +<li>:foo
 +</li>
 +</ul>
 +<ul>
 +<li>;foo
 +</li>
 +</ul>
 +<ol>
 +<li>*foo
 +</li>
 +</ol>
 +<ol>
 +<li>#foo
 +</li>
 +</ol>
 +<ol>
 +<li>:foo
 +</li>
 +</ol>
 +<ol>
 +<li>;foo
 +</li>
 +</ol>
  
  !!end
  
@@@ -17013,24 -16512,15 +17056,24 @@@ Lists: 2. Inside definition list
  
  :<nowiki>:foo</nowiki>
  !! result
 -<dl><dt>;foo
 -</dt></dl>
 -<dl><dt>:foo
 -</dt></dl>
 -<dl><dt>:foo
 -</dt><dd>bar
 -</dd></dl>
 -<dl><dd>:foo
 -</dd></dl>
 +<dl>
 +<dt>;foo
 +</dt>
 +</dl>
 +<dl>
 +<dt>:foo
 +</dt>
 +</dl>
 +<dl>
 +<dt>:foo
 +</dt>
 +<dd>bar
 +</dd>
 +</dl>
 +<dl>
 +<dd>:foo
 +</dd>
 +</dl>
  
  !!end
  
@@@ -17041,14 -16531,10 +17084,14 @@@ Lists: 3. Only bullets at start of tex
  
  *<nowiki>*foo</nowiki>''it''*bar
  !! result
 -<ul><li>*foo*bar
 -</li></ul>
 -<ul><li>*foo<i>it</i>*bar
 -</li></ul>
 +<ul>
 +<li>*foo*bar
 +</li>
 +</ul>
 +<ul>
 +<li>*foo<i>it</i>*bar
 +</li>
 +</ul>
  
  !!end
  
@@@ -17063,18 -16549,12 +17106,18 @@@ parsoi
  
  *[[Foo]]: bar
  !! result
 -<ul><li>foo*bar
 -</li></ul>
 -<ul><li><i>foo</i>*bar
 -</li></ul>
 -<ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
 -</li></ul>
 +<ul>
 +<li>foo*bar
 +</li>
 +</ul>
 +<ul>
 +<li><i>foo</i>*bar
 +</li>
 +</ul>
 +<ul>
 +<li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
 +</li>
 +</ul>
  !!end
  
  !! test
@@@ -17092,30 -16572,18 +17135,30 @@@ Lists: 5. No unnecessary escape
  
  * <s></s>: a
  !! result
 -<ul><li> bar <span>[[foo]]</span>
 -</li></ul>
 -<ul><li>=bar <span>[[foo]]</span>
 -</li></ul>
 -<ul><li>[[bar <span>[[foo]]</span>
 -</li></ul>
 -<ul><li>]]bar <span>[[foo]]</span>
 -</li></ul>
 -<ul><li>=bar <span>foo]]</span>=
 -</li></ul>
 -<ul><li> <s></s>: a
 -</li></ul>
 +<ul>
 +<li> bar <span>[[foo]]</span>
 +</li>
 +</ul>
 +<ul>
 +<li>=bar <span>[[foo]]</span>
 +</li>
 +</ul>
 +<ul>
 +<li>[[bar <span>[[foo]]</span>
 +</li>
 +</ul>
 +<ul>
 +<li>]]bar <span>[[foo]]</span>
 +</li>
 +</ul>
 +<ul>
 +<li>=bar <span>foo]]</span>=
 +</li>
 +</ul>
 +<ul>
 +<li> <s></s>: a
 +</li>
 +</ul>
  
  !!end
  
@@@ -6,8 -6,6 +6,8 @@@
   * @group Database
   * @group Parser
   * @group Stub
 + *
 + * @todo covers tags
   */
  class NewParserTest extends MediaWikiTestCase {
        static protected $articles = array(); // Array of test articles defined by the tests
                        $out = $parser->getPreloadText( $input, $title, $options );
                } else {
                        $output = $parser->parse( $input, $title, $options, true, true, 1337 );
+                       $output->setTOCEnabled( !isset( $opts['notoc'] ) );
                        $out = $output->getText();
  
                        if ( isset( $opts['showtitle'] ) ) {
         *
         * @group ParserFuzz
         */
 -      function testFuzzTests() {
 +      public function testFuzzTests() {
                global $wgParserTestFiles;
  
                $files = $wgParserTestFiles;