diff options
Diffstat (limited to 'tests/parser')
-rw-r--r-- | tests/parser/ParserTestResult.php | 5 | ||||
-rw-r--r-- | tests/parser/parserTest.inc | 39 | ||||
-rw-r--r-- | tests/parser/parserTests.txt | 4368 | ||||
-rw-r--r-- | tests/parser/parserTestsParserHook.php | 1 | ||||
-rw-r--r-- | tests/parser/preprocess/All_system_messages.expected | 7 | ||||
-rw-r--r-- | tests/parser/preprocess/All_system_messages.txt | 7 |
6 files changed, 3279 insertions, 1148 deletions
diff --git a/tests/parser/ParserTestResult.php b/tests/parser/ParserTestResult.php index 7d9415a2..a7b36721 100644 --- a/tests/parser/ParserTestResult.php +++ b/tests/parser/ParserTestResult.php @@ -1,10 +1,9 @@ <?php /** + * @file + * * @copyright Copyright © 2013, Antoine Musso * @copyright Copyright © 2013, Wikimedia Foundation Inc. - * @license GNU GPL v2 - * - * @file */ /** diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index a9df6832..1cffa20c 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -559,7 +559,7 @@ class ParserTest { $parser->setTransparentTagHook( $tag, $callback ); } - wfRunHooks( 'ParserTestParser', array( &$parser ) ); + Hooks::run( 'ParserTestParser', array( &$parser ) ); return $parser; } @@ -593,6 +593,14 @@ class ParserTest { } } + if ( isset( $opts['tidy'] ) ) { + if ( !$this->tidySupport->isEnabled() ) { + return $this->showSkipped(); + } else { + $options->setTidy( true ); + } + } + if ( isset( $opts['title'] ) ) { $titleText = $opts['title']; } else { @@ -624,10 +632,6 @@ class ParserTest { $output->setTOCEnabled( !isset( $opts['notoc'] ) ); $out = $output->getText(); if ( isset( $opts['tidy'] ) ) { - if ( !$this->tidySupport->isEnabled() ) { - return $this->showSkipped(); - } - $out = MWTidy::tidy( $out ); $out = preg_replace( '/\s+$/', '', $out ); } @@ -639,6 +643,14 @@ class ParserTest { $out = "$title\n$out"; } + if ( isset( $opts['showindicators'] ) ) { + $indicators = ''; + foreach ( $output->getIndicators() as $id => $content ) { + $indicators .= "$id=$content\n"; + } + $out = $indicators . $out; + } + if ( isset( $opts['ill'] ) ) { $out = implode( ' ', $output->getLanguageLinks() ); } elseif ( isset( $opts['cat'] ) ) { @@ -877,10 +889,7 @@ class ParserTest { 'wgDisableLangConversion' => false, 'wgDisableTitleConversion' => false, // Tidy options. - // We always set 'wgUseTidy' to false when parsing, but certain - // test-running modes still use tidy if available, so ensure - // that the tidy-related options are all set to their defaults. - 'wgUseTidy' => false, + 'wgUseTidy' => isset( $opts['tidy'] ), 'wgAlwaysUseTidy' => false, 'wgDebugTidy' => false, 'wgTidyConf' => $IP . '/includes/tidy.conf', @@ -901,7 +910,7 @@ class ParserTest { $this->savedGlobals = array(); /** @since 1.20 */ - wfRunHooks( 'ParserTestGlobals', array( &$settings ) ); + Hooks::run( 'ParserTestGlobals', array( &$settings ) ); foreach ( $settings as $var => $val ) { if ( array_key_exists( $var, $GLOBALS ) ) { @@ -941,7 +950,7 @@ class ParserTest { $tables = array( 'user', 'user_properties', 'user_former_groups', 'page', 'page_restrictions', 'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks', 'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks', - 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage', + 'site_stats', 'ipblocks', 'image', 'oldimage', 'recentchanges', 'watchlist', 'interwiki', 'logging', 'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo', 'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links' @@ -954,7 +963,7 @@ class ParserTest { // Allow extensions to add to the list of tables to duplicate; // may be necessary if they hook into page save or other code // which will require them while running tests. - wfRunHooks( 'ParserTestTables', array( &$tables ) ); + Hooks::run( 'ParserTestTables', array( &$tables ) ); return $tables; } @@ -1493,8 +1502,10 @@ class ParserTest { * Insert a temporary test article * @param string $name The title, including any prefix * @param string $text The article text - * @param int $line The input line number, for reporting errors - * @param bool $ignoreDuplicate Whether to silently ignore duplicate pages + * @param int|string $line The input line number, for reporting errors + * @param bool|string $ignoreDuplicate Whether to silently ignore duplicate pages + * @throws Exception + * @throws MWException */ public static function addArticle( $name, $text, $line = 'unknown', $ignoreDuplicate = '' ) { global $wgCapitalLinks; diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index f915922f..e9653529 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -16,7 +16,7 @@ # cat add category links # ill add inter-language links # subpage enable subpages (disabled by default) -# noxml don't check for XML well formdness +# noxml don't check for XML well-formedness # title=[[XXX]] run test using article title XXX # language=XXX set content language to XXX for this test # variant=XXX set the variant of language for this test (eg zh-tw) @@ -26,6 +26,7 @@ # php php-only test (not run by the parsoid parser unless # the test includes an html/parsoid section) # showtitle make the first line the title +# showindicators make the first lines the page status indicators # 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 @@ -69,6 +70,12 @@ Template:pipe | !! endarticle +!! article +Template:= +!! text +<nowiki>=</nowiki> +!! endarticle + !!article MediaWiki:bad image list !!text @@ -112,22 +119,50 @@ Template:echo_with_div !! endarticle !! article -Template:attr_str +Template:table_attribs !! text -{{{1}}}="{{{2}}}" +<noinclude> +|</noinclude>style="color:red;"|Foo !! endarticle !! article -Template:table_attribs +Template:table_attribs_2 +!! text +<noinclude> +|</noinclude>style="color:red;"|Foo +|Bar||Baz +!! endarticle + +!! article +Template:table_attribs_3 +!! text +<noinclude> +|</noinclude>style{{=}}"background:#f9f9f9;"|Foo +!! endarticle + +!! article +Template:table_attribs_4 +!! text +| style="background-color:#DC241f;" width="10px" | +!! endarticle + +!! article +Template:table_attribs_5 !! text <noinclude> -|</noinclude>style="color: red"| Foo +|</noinclude>style="color:red;"||Bar +!! endarticle + +!! article +Template:table_header_cells +!! text +{{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz !! endarticle !! article Template:table_cells !! text -{{table_attribs}} || Bar || Baz +{{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz !! endarticle !! article @@ -137,6 +172,22 @@ Template:image_attribs [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude> !! endarticle +## See T48811 for details +!! article +Template:mixed_attr_content_template +!! text +style="color:red;" title="T48811" +|- +|foo +!! endarticle + +!! article +Template:definition_list +!! text +one +::two +!! endarticle + !! article A?b !! text @@ -155,6 +206,39 @@ Template:OpenTable {| !!endarticle +!!article +Template:EmptyLITest +!!text +*a +* +* +*b +!!endarticle + +!!article +Template:EmptyTRTest +!!text +{| +|- +|- +|foo +|- +|- +|bar +|} +!!endarticle + +!!article +Template:EmptyTRWithHTMLAttrTest +!!text +<table> +<tr align="center"></tr> +<tr><td>foo</td></tr> +<tr align="center"></tr> +<tr><td>bar</td></tr> +</table> +!!endarticle + ### ### Basic tests ### @@ -505,11 +589,8 @@ Italics and bold: 2-quote opening sequence: (2,2) </p> !!end - !! test Italics and bold: 2-quote opening sequence: (2,3) -!! options -parsoid=wt2html !! wikitext ''foo''' !! html/* @@ -517,18 +598,6 @@ parsoid=wt2html </p> !!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki -!! wikitext -''<nowiki>foo'</nowiki>'' -!! html -<p><i>foo'</i> -</p> -!! end - - !! test Italics and bold: 2-quote opening sequence: (2,4) !! options @@ -540,18 +609,16 @@ parsoid=wt2html </p> !!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki !! wikitext -''<nowiki>foo''</nowiki>'' +''foo<nowiki>''</nowiki>'' !! html <p><i>foo''</i> </p> !! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 2-quote opening sequence: (2,5) @@ -589,12 +656,11 @@ Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki Italics and bold: 3-quote opening sequence: (3,2) !! wikitext '''foo'' -!! html +!! html/* <p>'<i>foo</i> </p> !!end - !! test Italics and bold: 3-quote opening sequence: (3,3) !! wikitext @@ -604,11 +670,8 @@ Italics and bold: 3-quote opening sequence: (3,3) </p> !!end - !! test Italics and bold: 3-quote opening sequence: (3,4) -!! options -parsoid=wt2html !! wikitext '''foo'''' !! html/* @@ -616,18 +679,6 @@ parsoid=wt2html </p> !!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki -!! wikitext -'''<nowiki>foo'</nowiki>''' -!! html -<p><b>foo'</b> -</p> -!! end - - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 3-quote opening sequence: (3,5) @@ -672,7 +723,6 @@ parsoid=wt2html </p> !!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki @@ -683,17 +733,15 @@ Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki </p> !! end - !! test Italics and bold: 4-quote opening sequence: (4,3) !! wikitext ''''foo''' -!! html +!! html/* <p>'<b>foo</b> </p> !!end - !! test Italics and bold: 4-quote opening sequence: (4,4) !! options @@ -705,18 +753,16 @@ parsoid=wt2html </p> !!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki !! wikitext -''''<nowiki>foo'</nowiki>''' +'<nowiki/>'''foo'''' !! html <p>'<b>foo'</b> </p> !! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 4-quote opening sequence: (4,5) @@ -736,7 +782,7 @@ parsoid=wt2html !! test Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki !! wikitext -''''foo'''''<nowiki/>'' +'<nowiki/>'''foo'''''<nowiki/>'' !! html/php <p>'<b>foo</b> </p> @@ -761,7 +807,6 @@ parsoid=wt2html </p> !!end - # same html as previous, but wikitext adjusted to match parsoid html2wt # skipping wt2html and html2html because it wants to put <i> before <b> !! test @@ -786,7 +831,6 @@ parsoid=wt2html </p> !!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 5-quote opening sequence: (5,3+2) @@ -797,7 +841,6 @@ Italics and bold: 5-quote opening sequence: (5,3+2) </p> !! end - !! test Italics and bold: 5-quote opening sequence: (5,4) !! options @@ -809,18 +852,6 @@ parsoid=wt2html </p> !!end - -# same html as previous, but wikitext adjusted to match parsoid html2wt -!! test -Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki -!! wikitext -'''''<nowiki>foo'</nowiki>''''' -!! html -<p><i><b>foo'</b></i> -</p> -!! end - - !! test Italics and bold: 5-quote opening sequence: (5,5) !! wikitext @@ -830,6 +861,15 @@ Italics and bold: 5-quote opening sequence: (5,5) </p> !!end +!! test +Italics and bold: 5-quote opening sequence: (5,6) +!! wikitext +'''''foo'''''' +!! html/* +<p><i><b>foo'</b></i> +</p> +!! end + ### ### multiple quote sequences in a line ### @@ -849,7 +889,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki !! wikitext -''<nowiki>foo'</nowiki>'''bar''''' +''foo'<nowiki/>'''bar''''' !! html <p><i>foo'<b>bar</b></i> </p> @@ -872,7 +912,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki !! wikitext -''<nowiki>foo'</nowiki>'''bar''''' +''foo'<nowiki/>'''bar''''' !! html <p><i>foo'<b>bar</b></i> </p> @@ -895,7 +935,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki !! wikitext -''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>''''' +''foo'<nowiki/>'''bar'<nowiki/>''''' !! html <p><i>foo'<b>bar'</b></i> </p> @@ -997,14 +1037,11 @@ parsoid=wt2html # same html as previous, but wikitext adjusted to match parsoid html2wt -# add 'parsoid' option to use 'parsoid' normalization of the placeholder !! test Italics and bold: other quote tests: (3,2,3+2+2,2) -!! options -parsoid !! wikitext '''this is about ''foo'''''<nowiki/>''s family'' -!! html/* +!! html <p><b>this is about <i>foo</i></b><i>s family</i> </p> !! end @@ -1012,10 +1049,9 @@ parsoid !! test Italics and bold: other quote tests: (3,2,3,3) -!! options !! wikitext '''this is about ''foo'''s family''' -!! html +!! html/* <p>'<i>this is about </i>foo<b>s family</b> </p> !!end @@ -1035,9 +1071,11 @@ Italics and bold: other quote tests: (3,(2,2),3) Italicized possessive !! wikitext The ''[[Main Page]]'''s talk page. -!! html +!! html/php <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page. </p> +!! html/parsoid +<p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p> !! end !! test @@ -1201,38 +1239,84 @@ Ruby markup (W3C-style) </p> !! end -# There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/ +# The next two test different paths in the sanitizer. !! test Non-word characters don't terminate tag names (bug 17663, 40670, 52022) !! wikitext -<b→> doesn't work! </b→> +<blockquote|>a</blockquote> + +<b→> doesn't terminate </b→> -<bä> doesn't work! </bä> +<bä> doesn't terminate </bä> -<boo> works fine </boo> +<boo> doesn't terminate </boo> -<s.foo>s.foo</s.foo> +<s.foo> doesn't terminate </s.foo> <sub-ID#1> !! html -<p><b→> doesn't work! </b→> -</p><p><bä> doesn't work! </bä> -</p><p><boo> works fine </boo> -</p><p><s.foo>s.foo</s.foo> +<p><blockquote|>a</blockquote> +</p><p><b→> doesn't terminate </b→> +</p><p><bä> doesn't terminate </bä> +</p><p><boo> doesn't terminate </boo> +</p><p><s.foo> doesn't terminate </s.foo> </p><p><sub-ID#1> </p> !! end +# There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/ +# If the non-word-character tag made it through the sanitizer, tidy +# would munge it up. +!! test +Non-word characters don't terminate tag names + tidy +!! wikitext +<blockquote|>a</blockquote> + +<b→> doesn't terminate </b→> + +<bä> doesn't terminate </bä> + +<boo> doesn't terminate </boo> + +<s.foo> doesn't terminate </s.foo> + +<sub-ID#1> +!! html+tidy +<p><blockquote|>a</p> +<p><b→> doesn't terminate </b→></p> +<p><bä> doesn't terminate </bä></p> +<p><boo> doesn't terminate </boo></p> +<p><s.foo> doesn't terminate </s.foo></p> +<p><sub-ID#1></p> +!! end + +### +### See tests/parser/parserTestsParserHook.php for the <tåg> extension) +### This checks that HTML5 tags (with non-word characters in the tag +### name) make it safely through the parser -- the Sanitizer will +### munge them later, as it should. +### +!! test +Non-word characters are valid in extension tags (T19663) +!! wikitext +<tåg>tåg</tåg> +!! html +<pre> +'tåg' +array ( +) +</pre> + +!! end + !! test Isolated close tags should be treated as literal text (bug 52760) !! wikitext </b> <s.foo>s</s> -!! html -<p></b> -</p><p><s.foo>s</s> -</p> +!! html+tidy +<p><s.foo>s</p> !! end ### @@ -1328,18 +1412,75 @@ parsoid !! wikitext {{echo|–}} !! html -<p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span> -</p> +<p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span></p> !! end !! test Properly escape nowiki when combined with other wiki markup !! options parsoid=html2wt +!! html +<p>* </nowiki> tag</p> !! wikitext <nowiki>* </nowiki></nowiki> tag +!! end + +!! test +T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars +!! options +parsoid=html2wt !! html -<p>* </nowiki> tag</p> +<p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a> +This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a> +This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p> +!! wikitext +This text: L'[[Foo]] +This text: L<nowiki>''</nowiki>[[Foo]] +This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki> +!! end + +# This test fails because wikitext whitespace is not normalized before comparing. +!! test +T71950: 2. Put nowiki as close to cause as possible, after ' :' +!! options +parsoid=html2wt +!! html +<p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a> +</p> +!! wikitext +This text : L<nowiki>''</nowiki>[[Foo]] +!! end + +# This test and the next one are html2wt only as they test that incorrect wikitext +# passed in template arguments gets escaped or wrapped in nowikis where required. +!! test +T71482: Use {{!}} instead of nowiki for single pipe in template argument +!! options +parsoid=html2wt +!! html/parsoid +<p><span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo|bar"}},"i":0}}]}" about="#mwt1"></span> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo|bar |[["}},"i":0}}]}" about="#mwt2"></p> +!! wikitext +{{echo|foo{{!}}bar}} +{{echo|<nowiki>foo|bar |[[</nowiki>}} +!! end + +!! test +T53961: Output correct nowikis in template arguments +!! options +parsoid=html2wt +!! html/parsoid +<p><span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a [ b"}},"i":0}}]}" about="#mwt1"></span> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a }} b"}},"i":0}}]}" about="#mwt2"></span> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a [[ b"}},"i":0}}]}" about="#mwt3"></span> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a | {{ ]]"}},"i":0}}]}" about="#mwt4"></span> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a }"}},"i":0}}]}" about="#mwt5"></span></p> +!! wikitext +{{echo|a [ b}} +{{echo|a <nowiki>}}</nowiki> b}} +{{echo|<nowiki>a [[ b</nowiki>}} +{{echo|a {{!}} <nowiki>{{ ]]</nowiki>}} +{{echo|a <nowiki>}</nowiki>}} !! end ### @@ -1488,6 +1629,19 @@ Comment semantics: unclosed comment at end !! end +# Bug 58184: document parsoid's behaviour +!! test +Suppress comment closing tag in lenient browsers +!! options +parsoid=wt2html,html2html +!! wikitext +<!-- Browsers--!> think this is closed --> +!! html/php + +!! html/parsoid +<!-- Browsers--¡> think this is closed --> +!! end + !! test Comment in template title !! wikitext @@ -1649,6 +1803,11 @@ x <div>foo</div> z <p>z</p> !! end +# Tidy strips out the empty <div> tags. Parsoid doesn't. +# So, we have a separate section for Parsoid. We don't want +# to mimic this stripping behavior in Parsoid. It affects +# editing experience and also requires us to maintain additional +# info for RT-ing. !! test Empty lines between lines with block tags !! wikitext @@ -1687,10 +1846,22 @@ b <p>d</p> <p><br /></p> <div>e</div> +!! html/parsoid +<div data-parsoid='{"stx":"html"}'></div> + +<p><br /></p> +<div data-parsoid='{"stx":"html"}'></div><p>a</p> + +<p>b</p> +<div data-parsoid='{"stx":"html"}'>a</div><p>b</p> + +<div data-parsoid='{"stx":"html"}'>b</div><p>d</p> + +<p><br /></p> +<div data-parsoid='{"stx":"html"}'>e</div> !! end ## PHP parser emits output which is broken -## XXX The parsoid output doesn't match the tidy output. !! test Unclosed HTML p-tags should be handled properly !! wikitext @@ -1700,15 +1871,42 @@ a b !! html/php+tidy <div> -<p>foo</div></p> +<p>foo</p> +</div> <p>a</p> -b</div> +<p>b</p> !! html/parsoid <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div> <p>a</p> <p>b</p> !! end +## SSS FIXME: I can come up with other scenarios where this doesn't work because +## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore +## them for now. +!! test +1. P-wrapping should leave sol-transparent tags outside p-tags where possible +!! options +parsoid=wt2html +!! wikitext +a [[Category:A1]] [[Category:A2]] +[[Category:A3]] +[[Category:A4]] +!! html/parsoid +<p>a</p> +<link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/> +!! end + +!! test +2. P-wrapping should leave sol-transparent tags outside p-tags where possible +!! options +parsoid=wt2html +!! wikitext +[[Category:A1]]a +!! html/parsoid +<link href="Category:A1"/><p>a</p> +!! end + ### ### Preformatted text ### @@ -1966,8 +2164,11 @@ Entities inside <pre> </p> !! end +# Parsoid doesn't strip empty tags, like Tidy does. !! test Empty pre; pre inside other HTML tags (bug 54946) +!! options +parsoid=wt2html,wt2wt !! wikitext a @@ -1975,7 +2176,7 @@ a foo </pre></div> <pre></pre> -!! html +!! html/php <p>a </p> <div><pre> @@ -1983,12 +2184,18 @@ foo </pre></div> <pre></pre> -!! html+tidy +!! html/php+tidy <p>a</p> <div> <pre> foo </pre></div> +!! html/parsoid +<p>a</p> + +<div><pre>foo +</pre></div> +<pre></pre> !! end !! test @@ -2156,10 +2363,11 @@ parsoid=wt2html <table><pre></pre></table> !! html/parsoid -<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'><pre </span> -<pre>x</pre> +<pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"<pre":null},"sa":{"<pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'>x</pre> + + +<p><pre </p> -<span><pre </span> <table></table> !! end @@ -2335,6 +2543,41 @@ Templates: Handle comments in the target <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p> !!end +!! test +Templates: Handle comments in parameter names (bug 67657) +!! wikitext +{{echo|1 +<!-- should be ignored --> +=foo}} + +{{echo| +<!-- should be ignored --> +1 = foo}} + +{{echo|1<!-- should be ignored --> = foo}} + +{{echo|<!-- should be ignored -->1 = foo}} +!!html/parsoid +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n<!-- should be ignored -->"}}},"i":0}}]}'>foo</p> + +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"<!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p> + +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1<!-- should be ignored -->"}}},"i":0}}]}'>foo</p> + +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"<!-- should be ignored -->1"}}},"i":0}}]}'>foo</p> +!!end + +!! test +Templates: Other wikitext in parameter names (bug 67657) +!! wikitext +{{echo|''1''=foo}} +!!html/parsoid +<p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"''1''":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p> +!!html/php +<p>{{{1}}} +</p> +!!end + #-------------------------------------------------------------------- # Transclusion parameter escaping tests #-------------------------------------------------------------------- @@ -2431,6 +2674,18 @@ parsoid <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p> !! end +## Bug T73412 +!! test +Templates: Preserve blank parameter names +!! wikitext +{{echo|=foo}} +!! html/php +<p>{{{1}}} +</p> +!! html/parsoid +<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p> +!! end + ### ### Parsoid-centric tests for testing RT edge cases for pre ### @@ -2559,12 +2814,8 @@ c !! html/parsoid <pre>a</pre> - -<table> - -<tbody> -<tr> -<td> b</td></tr> + <table> + <tbody><tr><td> b</td></tr> </tbody></table> !!end @@ -2613,6 +2864,12 @@ a c <blockquote> foo </blockquote> <pre><span> foo </span> </pre> +!! html/parsoid + <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p> + <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div> + <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote> +<pre><span> foo </span> +</pre> !! html+tidy <p>a</p> <p>foo</p> @@ -2637,6 +2894,9 @@ a </pre> b <div> foo </div> +!! html/parsoid +<pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre> + b <div data-parsoid='{"stx":"html"}'> foo </div> !! html+tidy <pre> a <span>foo</span> @@ -2718,7 +2978,7 @@ File:foobar.jpg !! html a <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> @@ -2730,7 +2990,7 @@ File:foobar.jpg <li class="gallerybox" style="width: 155px"> <div style="width: 155px"> <div class="thumb" style="width: 150px;"> -<div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div> +<div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div> </div> <div class="gallerytext"></div> </div> @@ -2878,8 +3138,7 @@ parsoid=wt2html,wt2wt {{echo| [[Category:foo]]}} <!-- No pre-wrapping --> !! html <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping --> -<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span> -<link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping --> +<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping --> !! end !! test @@ -2892,7 +3151,6 @@ parsoid=wt2html,wt2wt !! html <pre> <link rel="mw:PageProp/Category" href="./Category:Foo"> a - <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre> !! end @@ -3110,10 +3368,12 @@ Definition list with wikilink containing colon Definition list with news link containing colon !! wikitext ; news:alt.wikipedia.rox: This isn't even a real newsgroup! -!! html +!! html/php <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> +!! html/parsoid +<dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl> !! end !! test @@ -3803,7 +4063,7 @@ Definition Lists: Weird Ones: Test 1 <dl> <dt> <dl> -<dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'> </span></dt> +<dt> foo<span typeof="mw:Placeholder"> </span></dt> <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd> </dl></dt> </dl></dd> @@ -3815,6 +4075,122 @@ Definition Lists: Weird Ones: Test 1 </ul> !! end +!! test +Definition Lists: colons occurring in tags +!! wikitext +;a:b +;'''a:b''' +;<i>a:b</i> +;<span>a:b</span> +;<div>a:b</div> +;<div>a +:b</div> +;{{echo|a:b}} +;{{echo|''a:b''}} +;;;''a:b'' +!! html+tidy +<dl> +<dt>a</dt> +<dd>b</dd> +<dt><b>a:b</b></dt> +<dt><i>a:b</i></dt> +<dt><span>a:b</span></dt> +<dd> +<div>a:b</div> +</dd> +<dd> +<div>a +<dl> +<dd>b</dd> +</dl> +</div> +</dd> +<dt>a</dt> +<dd>b</dd> +<dt><i>a:b</i></dt> +</dl> +<dl> +<dd> +<dl> +<dd> +<dl> +<dt><i>a:b</i></dt> +</dl> +</dd> +</dl> +</dd> +</dl> +!! end + +!! test +Definition Lists: colons and tables 1 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html +<dl><dd><table> +<tr> +<td> x +</td></tr></table></dd></dl> +<dl><dd><table> +<tr> +<td> y +</td></tr></table></dd></dl> + +!! end + +# Parsoid's output (as documented below) differs from php's in this case. +# This is probably a bug. If we fixup parsoid to match php's output, the +# above test should pass and the below test case can be removed. It is +# unclear which output is more desirable. + +!! test +Definition Lists: colons and tables 2 +!! wikitext +:{| +| x +|} +:{| +| y +|} +!! html/parsoid +<dl><dd><table> +<tr> +<td> x +</td></tr></table></dd> +<dd><table> +<tr> +<td> y +</td></tr></table></dd></dl> +!! end + +!! test +Definition Lists: template interaction +!! wikitext +::{{definition_list}} + +:one +::{{definition_list}} +:::two +:::three +::four +!! html/parsoid +<dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1"> +</span><dd about="#mwt1">two</dd></dl></dd></dl> + +<dl><dd data-parsoid='{}'>one +<dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2"> +</span><dd about="#mwt2">two +<dl><dd>two</dd> +<dd>three</dd></dl></dd> +<dd data-parsoid='{}'>four</dd></dl></dd></dl> +!! end + + ### ### External links ### @@ -4004,8 +4380,79 @@ External links: with no contents </p> !! html/parsoid <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p> +!! end + +!! test +External links: Free with trailing punctuation +!! wikitext +http://example.com, +http://example.com; +http://example.com\ +http://example.com. +http://example.com: +http://example.com! +http://example.com? +http://example.com) +http://example.com/url_with_(brackets) +(http://example.com/url_without_brackets) +http://example.com/url_with_entity +http://example.com/url_with_entity  +http://example.com/url_with_entity  +http://example.com/url_with_entity< +http://example.com/url_with_entity< +http://example.com/url_with_entity< +!! html/php +<p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>; +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\ +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>. +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>: +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>! +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>? +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) +<a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a> +(<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>) +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>< +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a> +<a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a> +</p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>, +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>; +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\ +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>. +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>: +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>! +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>? +<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>) +<a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a> +(<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>) +<a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a> +<a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity"><</span> +<a rel="mw:ExtLink" href="http://example.com/url_with_entity<">http://example.com/url_with_entity<</a> +<a rel="mw:ExtLink" href="http://example.com/url_with_entity<">http://example.com/url_with_entity<</a></p> +!! end + +!! test +External links: No preceding word characters allowed (bug 65278) +!! wikitext +NOPEhttp://example.com +N0http://example.com +ok:http://example.com +ok-http://example.com +!! html +<p>NOPEhttp://example.com +N0http://example.com +ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> +ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> +</p> !! end !! test @@ -4095,10 +4542,12 @@ URL in text: [http://example.com http://example.com] External links: Clickable images !! wikitext ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] -!! html +!! html/php <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a> </p> -!!end +!! html/parsoid +<p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p> +!! end !! test External links: raw ampersand @@ -4288,10 +4737,12 @@ http://www.example.com/<hello> BUG 289: literal ">"-token in URL-tail !! wikitext http://www.example.com/<b>html</b> -!! html +!! html/php <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b> </p> -!!end +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p> +!! end !! test BUG 289: ">"-token in bracketed URL @@ -4410,7 +4861,7 @@ http://www.example.com/?title=AT%26T <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p> !! end -# According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain +# According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain # % is actually legal in HTML5. Any change in output would need testing though. !! test Bug 4781, 5267: %25 in URL @@ -4751,7 +5202,7 @@ Parenthesis in external links, w/ transclusion or comment </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) </p> !! html/parsoid -<p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;hi&quot;}},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[20,31,null,null]}\">hi</span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p> +<p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[20,31,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;hi&quot;}},&quot;i&quot;:0}}]}\">hi</span>"}]]}'>http://example.com/hi</a>)</p> <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com<!-- hi -->"}}'>http://example.com</a>)</p> !! end @@ -5129,8 +5580,8 @@ Accept "!!" in table data </td></tr></table> !! html/parsoid -<table data-parsoid='{}'> -<tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr> +<table> +<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr> </tbody></table> !! end @@ -5295,7 +5746,6 @@ Invalid attributes in table cell (bug 1830) !! end - # The "|}" to close the table is missing from the input, so parsoid's # *2wt modes will fail. !! test @@ -5320,6 +5770,25 @@ parsoid=wt2html,html2html <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table> !! end +# FIXME: The php output is broken. +!! test +! and || in td attributes should not be parsed as <th>/<td> +!! wikitext +{| +| style="color: red !important;" data-contrived="put this here ||" | foo +|} +!! html/php +<table> +<tr> +<td> style="color: red !important;" data-contrived="put this here </td> +<td> foo +</td></tr></table> + +!! html/parsoid +<table> +<tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr> +</tbody></table> +!! end !! test Indented table markup mixed with indented pre content (proposed in bug 6200) @@ -5344,50 +5813,83 @@ Indented table markup mixed with indented pre content (proposed in bug 6200) !! end !! test -Template-generated table cell attributes and cell content +1. Template-generated table cell attributes and cell content !! wikitext {| |{{table_attribs}} | {{table_attribs}} +|| {{table_attribs_5}} +| <!--foo--> <!--bar--> <!--baz--> {{table_attribs}} +|align=center {{table_attribs}} +| <!--foo--> align=center <!--bar--> {{table_attribs}} |} !! html <table> <tr> -<td style="color: red"> Foo +<td style="color:red;">Foo </td> -<td style="color: red"> Foo +<td style="color:red;">Foo +</td> +<td> style="color:red;"</td> +<td>Bar +</td> +<td style="color:red;">Foo +</td> +<td align="center" style="color:red;">Foo +</td> +<td align="center" style="color:red;">Foo </td></tr></table> !! end !! test -Template-generated table cell attributes and cell content (2) +2. Template-generated table cell attributes and cell content !! wikitext {| -|align=center {{table_attribs}} +|{{table_attribs_2}} |} -!! html +!! html/php <table> <tr> -<td align="center" style="color: red"> Foo +<td style="color:red;">Foo +</td> +<td>Bar</td> +<td>Baz </td></tr></table> +!! html/parsoid +<table> +<tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td> +<td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr> +</tbody></table> !! end !! test -Template-generated table cell attributes and cell content (3) +3. Template-generated table cell attributes and cell content !! wikitext {| +!align=center {{table_header_cells}} +|- |align=center {{table_cells}} |} -!! html +!! html/php <table> <tr> -<td align="center" style="color: red"> Foo </td> -<td> Bar </td> -<td> Baz +<th align="center" style="color:red;">Foo</th> +<th style="color:red;"><i>Bar</i></th> +<th style="color:brown;"><i>Foo</i> and Baz +</th></tr> +<tr> +<td align="center" style="color:red;">Foo</td> +<td style="color:red;"><i>Bar</i></td> +<td style="color:brown;"><i>Foo</i> and Baz </td></tr></table> +!! html/parsoid +<table> +<tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr> +<td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr> +</tbody></table> !! end !! test @@ -5450,7 +5952,7 @@ Wikitext table with a lot of comments <!-- c0 --> | foo <!-- c1 --> -|- <!-- c2 --> +|-<!-- c2 --> <!-- c3 --> |<!-- c4 --> <!-- c5 --> @@ -5467,6 +5969,26 @@ Wikitext table with a lot of comments !! end !! test +Wikitext table comments represented in parsoid dom +!! wikitext +{|<!--c1--><!--c2--> +|-<!--c3--> +| x +|} +!! html/php+tidy +<table> +<tr> +<td>x</td> +</tr> +</table> +!! html/parsoid +<table><!--c1--><!--c2--> +<tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3--> +<td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr> +</tbody></table> +!! end + +!! test Wikitext table with double-line table cell !! wikitext {| @@ -5548,6 +6070,68 @@ Build table with {{!}} !! end +!! test +Build table with pipe as data +!! wikitext +{| class="wikitable" +! header +! second header +|- style="color:red;" +| data || style="color:red;" | second data +|- +| style="color:red;" | data with | || style="color:red;" | second data with | +|- +|| data with | ||| second data with | +|} +!! html +<table class="wikitable"> +<tr> +<th> header +</th> +<th> second header +</th></tr> +<tr style="color:red;"> +<td> data </td> +<td style="color:red;"> second data +</td></tr> +<tr> +<td style="color:red;"> data with | </td> +<td style="color:red;"> second data with | +</td></tr> +<tr> +<td> data with | </td> +<td> second data with | +</td></tr></table> + +!! end + +!! test +Build table with wikilink +!! wikitext +{| class="wikitable" +! header || second header +|- style="color:red;" +| data [[Main Page|linktext]] || second data [[Main Page|linktext]] +|- +| data || second data [[Main Page|link|text with pipe]] +|} +!! html +<table class="wikitable"> +<tr> +<th> header </th> +<th> second header +</th></tr> +<tr style="color:red;"> +<td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td> +<td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a> +</td></tr> +<tr> +<td> data </td> +<td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a> +</td></tr></table> + +!! end + # The expected HTML structure in this test is debatable. The PHP parser does # not parse this kind of table at all. The main focus for Parsoid is on # round-tripping, so this output is ok for now. TODO: revisit! @@ -5574,7 +6158,7 @@ Wikitext table with html-syntax row !! test Implicit <td> after a |- !! options -parsoid=wt2html,wt2wt +parsoid=wt2html,html2html !! wikitext {| |- @@ -5598,7 +6182,7 @@ a !! test <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context !! options -parsoid=wt2html,wt2wt +parsoid=wt2html,html2html !! wikitext {| |- @@ -5638,10 +6222,11 @@ a !! end # PHP + Tidy strips the list out of the table; Parsoid wraps it. +# Parsoid generates the missing <td>, so wt2wt won't succeed. !! test Lists should be recognized in an implicit <td> context !! options -parsoid=wt2html,wt2wt +parsoid=wt2html,html2html !! wikitext {| |- @@ -5668,6 +6253,28 @@ parsoid=wt2html,wt2wt !! end !! test +Table cells not properly parsed in an implicit-td context +!! wikitext +{| +|- +{{table_attribs_4}} || a || b +|} +!! html/php+tidy +<table> +<tr> +<td style="background-color:#DC241f;" width="10px"></td> +<td>a</td> +<td>b</td> +</tr> +</table> +!! html/parsoid +<table> +<tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'> +<td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr> +</tbody></table> +!! end + +!! test Parsoid: Round-trip tables directly followed by content (bug 51219) !! options parsoid=wt2html,wt2wt @@ -5679,20 +6286,30 @@ parsoid=wt2html,wt2wt {| |baz |}<b>quux</b> -!! html -<table><tbody> +!! html+tidy +<table> <tr> -<td>foo</td></tr></tbody></table> bar +<td>foo</td> +</tr> +</table> +<p>bar</p> <table> -<tbody> <tr> -<td>baz</td></tr></tbody></table><b>quux</b> +<td>baz</td> +</tr> +</table> +<p><b>quux</b></p> !! end !! test Parsoid: Default to a newline after tables in new content (bug 51219) !! options parsoid=html2wt +!! html +<table><tbody> +<tr><td>foo</td></tr></tbody></table> bar +<table><tbody> +<tr><td>baz</td></tr></tbody></table><b>quux</b> !! wikitext {| |foo @@ -5702,23 +6319,18 @@ parsoid=html2wt |baz |} '''quux''' -!! html -<table><tbody> -<tr><td>foo</td></tr></tbody></table> bar -<table><tbody> -<tr><td>baz</td></tr></tbody></table><b>quux</b> !! end !! test Parsoid: newline inducing block nodes don't suppress <nowiki> !! options parsoid=html2wt +!! html + a<h1>foo</h1> !! wikitext <nowiki> </nowiki>a = foo = -!! html - a<h1>foo</h1> !! end !! test @@ -5823,6 +6435,27 @@ parsoid=html2wt |} !! end +!!test +Testing serialization after deletion of table cells +!!options +parsoid={ + "modes": ["wt2wt", "selser"], + "changes": [ + ["#x", "remove"] + ] +} +!!wikitext +{| +!h1 !!h2 !!h3 +| id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3 +|} +!! wikitext/edited +{| +!h1 !!h2 !!h3 +|c2 |||c3 +|} +!!end + ### ### Internal links ### @@ -5953,9 +6586,11 @@ Bug 43661: Piped links with identical prefixes Link with HTML entity in suffix / tail !! wikitext [[Main Page]]", [[Main Page]]a -!! html +!! html/php <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>", <a href="/wiki/Main_Page" title="Main Page">Main Page</a>a </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&#97;","srcContent":"a"}'>a</span></p> !! end !! test @@ -5990,10 +6625,13 @@ Piped link with extlink-like text !! wikitext [[Main Page|[bar]]] [[Main Page|This is a [bar]]] -!! html +!! html/php <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a> <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a> +<a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p> !! end !! test @@ -6058,11 +6696,10 @@ Namespace takes precedence over interwiki link (bug 51680) Link to namespace preferred over interwiki with correct rel attribute !! options parsoid=html2wt,html2html +!! html +<p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p> !! wikitext [[MemoryAlpha:AlphaTest]] -!! html -<p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a> -</p> !! end !! test @@ -6213,7 +6850,7 @@ Link containing double-single-quotes '' in text embedded in italics (bug 4598 sa !! test Link with double quotes in title part (literal) and alternate part (interpreted) !! wikitext -[[File:Denys Savchenko ''Pentecoste''.jpg]] +[[File:Denys_Savchenko_''Pentecoste''.jpg]] [[''Pentecoste'']] @@ -6227,7 +6864,7 @@ Link with double quotes in title part (literal) and alternate part (interpreted) </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a> </p> !! html/parsoid -<meta typeof="mw:Placeholder"/> +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p> <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p> <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p> <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p> @@ -6237,15 +6874,20 @@ Link with double quotes in title part (literal) and alternate part (interpreted) Broken image links with HTML captions (bug 39700) !! wikitext [[File:Nonexistent|<script></script>]] -[[File:Nonexistent|100px|<script></script>]] +[[File:Nonexistent|100x100px|<script></script>]] [[File:Nonexistent|<]] [[File:Nonexistent|a<i>b</i>c]] -!! html +!! html/php <p><a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><script></script></a> <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><script></script></a> <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><</a> <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a> </p> +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"<script></script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span> +<span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"<script></script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span> +<span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span> +<span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a<i>b</i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p> !! end !! test @@ -6483,7 +7125,7 @@ title=[[User:test/123]] <p><a href="#a">b</a> </p> !! html/parsoid -<p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p> +<p><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p> !! end !! test @@ -6503,7 +7145,7 @@ parsoid !! wikitext {{echo|Some [[Fool]]}}s !! html -<p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p> +<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p> !! end !! test @@ -6513,7 +7155,7 @@ parsoid !! wikitext {{echo|Some [[Fool]]s are '''bold and foolish'''}} !! html -<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are '''bold and foolish'''"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p> +<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are '''bold and foolish'''"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p> !! end !! article @@ -6562,10 +7204,10 @@ mótmælenda[[söfnuður|söfnuðir]]xxx Parsoid link trail escaping !! options parsoid=html2wt,html2html -!! wikitext -[[apple]]<nowiki/>s !! html <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p> +!! wikitext +[[apple]]<nowiki/>s !! end !! test @@ -6573,10 +7215,10 @@ Parsoid link prefix escaping !! options language=is parsoid=html2wt,html2html -!! wikitext -Aðrir mótmælenda<nowiki/>[[söfnuður]] !! html <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p> +!! wikitext +Aðrir mótmælenda<nowiki/>[[söfnuður]] !! end !! test @@ -6624,20 +7266,28 @@ Link with angle bracket after anchor !! test Inline interwiki link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[MeatBall:SoftSecurity]] -!! html +!! html/php <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a> </p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p> !! end !! test Inline interwiki link with empty title (bug 2372) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[MeatBall:]] -!! html +!! html/php <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a> </p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p> !! end !! test @@ -6666,6 +7316,10 @@ Interwiki link with fragment (bug 2130) !! end # Ideally the wikipedia: prefix here should be proto-relative too +# [CSA]: this is kind of a bogus test, as the PHP parser test doesn't +# define the 'en' prefix, and originally the test used 'wikipedia', +# which isn't a localinterwiki prefix hence the links to the 'en:Foo' +# article. !! test Different interwiki prefixes mapping to the same URL !! wikitext @@ -6683,19 +7337,19 @@ Different interwiki prefixes mapping to the same URL [[ wikiPEdia :Foo]] !! html/parsoid -<p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>en:Foo</a></p> +<p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p> -<p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>Foo</a></p> +<p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}'>wikipedia:Foo</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}'>Foo</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}'>wikipedia:en:Foo</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}'>wikipedia:en:Foo</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p> -<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}'> wikiPEdia :Foo</a></p> +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p> !! end !! test @@ -6707,60 +7361,97 @@ Interwiki links that cannot be represented in wiki syntax [http://de.wikipedia.org/wiki/Foo?action=history has query] [http://de.wikipedia.org/wiki/#foo is just fragment] +!! html/php +<p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a> +<a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a> +<a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a> +<a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a> +<a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a> +</p> !! html/parsoid -<p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a> -<a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a> -<a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a> +<p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a> +<a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a> +<a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a> <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a> <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p> !! end !! test Interwiki links: trail -!! options -parsoid !! wikitext [[wikipedia:Foo|Ba]]r -!! html -<p data-parsoid='{}'><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}'>Bar</a></p> +!! html/php +<p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a> +</p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p> !! end !! test Local interwiki link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[local:Template:Foo]] -!! html +!! html/php <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p> !! end +# Parsoid does not mark self-links, by design. !! test Local interwiki link: self-link to current page !! options title=[[Main Page]] +parsoid=wt2html,wt2wt,html2html !! wikitext [[local:Main Page]] -!! html +!! html/php <p><strong class="selflink">local:Main Page</strong> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p> !! end !! test Local interwiki link: prefix only (bug 64167) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[local:]] -!! html +!! html/php <p><a href="/wiki/Main_Page" title="Main Page">local:</a> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p> !! end !! test Local interwiki link: with additional interwiki prefix (bug 61357) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext [[local:meatball:Hello]] -!! html +!! html/php <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a> </p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p> +!! end + +!! test +Multiple local interwiki link prefixes +!! wikitext +[[local:local:local:local:mi:local:Foo]] +!! options +parsoid=wt2html,wt2wt,html2html +!! html/php +<p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p> !! end ### @@ -6770,6 +7461,8 @@ Local interwiki link: with additional interwiki prefix (bug 61357) !! test Interlanguage link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[zh:Chinese]] @@ -6777,12 +7470,14 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/> !! end !! test Interlanguage link with spacing +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[ zh : Chinese ]] @@ -6790,12 +7485,14 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/> !! end !! test Double interlanguage link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[es:Spanish]] @@ -6804,24 +7501,30 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/> -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/> !! end !! test Interlanguage link variations +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[ es :Spanish]] [[ ZH :Chinese]] +[[es:Foo_bar]] +[[es:Foo bar]] !! html/php <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"//es.wikipedia.org/wiki/Spanish"},"sa":{"href":" es :Spanish"}}'/> -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"//zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" /> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" /> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" /> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" /> !! end !! test @@ -6835,8 +7538,8 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/> !! end !! test @@ -6851,9 +7554,9 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/> -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/> !! end !! test @@ -6865,8 +7568,8 @@ Blah blah blah <p>Blah blah blah </p> !! html/parsoid -<p>Blah blah blah -<link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p> +<p>Blah blah blah</p> +<link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/> !! end !! test @@ -6884,84 +7587,119 @@ language=ln Parsoid bug 53221: Wikilinks should be properly entity-escaped !! options parsoid=html2wt +!! html +<p>He&nbsp;llo <a href="Foo" rel="mw:WikiLink">He&nbsp;llo</a></p> +<p>He&nbsp;llo <a href="He&nbsp;llo" rel="mw:WikiLink">He&nbsp;llo</a></p> !! wikitext He&nbsp;llo [[Foo|He&nbsp;llo]] He&nbsp;llo [[He&nbsp;llo]] -!! html -<p>He&nbsp;llo <a href="Foo" rel="mw:WikiLink">He&nbsp;llo</a></p> -<p>He&nbsp;llo <a href="He&nbsp;llo" rel="mw:WikiLink">He&nbsp;llo</a></p> !! end !! test Parsoid: handle constructor well -!! options -parsoid !! wikitext [[constructor]] [[constructor:foo]] -!! html +!! html/php +<p><a href="/index.php?title=Constructor&action=edit&redlink=1" class="new" title="Constructor (page does not exist)">constructor</a> +</p><p><a href="/index.php?title=Constructor:foo&action=edit&redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a> +</p> +!! html/parsoid <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}">constructor</a></p> <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"constructor:foo"}}">constructor:foo</a></p> !! end +!! article +ko: +!! text +Test. +!! endarticle + +# Note that `ko` isn't a known interlanguage prefix !! test Parsoid: recognize interlanguage links without a target page !! options -parsoid +ill !! wikitext +[[es:]] + [[ko:]] -!! html -<p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p> +!! html/php +es: +!! html/parsoid +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/> + +<p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p> !! end +# Note that `ko` isn't a known interwiki prefix !! test Parsoid: recognize interwiki links without a target page !! options -parsoid +parsoid=wt2html,wt2wt,html2html !! wikitext +[[:es:]] + [[:ko:]] -!! html -<p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p> +!! html/php +<p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a> +</p><p><a href="/wiki/Ko:" title="Ko:">ko:</a> +</p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p> +<p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p> !! end !! test -Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links -!! options -parsoid +Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209) !! wikitext -[[en:Foo]] -!! html -<p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p> +[[mi:Foo]] +!! html/php +<p><a href="/wiki/Foo" title="Foo">mi:Foo</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p> !! end !! test Interlanguage link with preceding local interwiki link (bug 68085) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[local:es:Spanish]] -!! html +!! html/php <p>Blah blah blah <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a> </p> +!! html/parsoid +<p>Blah blah blah +<a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p> !! end !! test Looks like an interlanguage link, but is actually a local interwiki +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[mi:Template:Foo]] -!! html +!! html/php <p>Blah blah blah <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a> </p> +!! html/parsoid +<p>Blah blah blah +<a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p> !! end ### ### Redirects, Parsoid-only ### + !! test 1. Simple redirect to page !! options @@ -6972,17 +7710,20 @@ parsoid <link rel="mw:PageProp/redirect" href="./Main_Page"> !! end -# Only wt2html and html2html since "Main_Page" will serialize to "Main Page" !! test 2. Other redirect variants -!! options -parsoid=wt2html,wt2wt !! wikitext #REDIRECT [[Main_Page]] +!! html/parsoid +<link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/> +!! end + +!! test +3. Other redirect variants +!! wikitext #REDIRECT [[<nowiki>[[Bar]]</nowiki>]] -!! html -<link rel="mw:PageProp/redirect" href="./Main_Page"> -<link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D"> +!! html/parsoid +<link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./%5B%5BBar%5D%5D"},"sa":{"href":"<nowiki>[[Bar]]</nowiki>"}}'/> !! end !! test @@ -7039,7 +7780,7 @@ parsoid=wt2html !! test Redirect to category !! options -parsoid=wt2html +parsoid=wt2wt,wt2html !! wikitext #REDIRECT [[Category:Foo]] !! html @@ -7059,11 +7800,11 @@ parsoid=wt2html !! test Redirect to category page !! options -parsoid=wt2html,html2html +parsoid !! wikitext #REDIRECT [[:Category:Foo]] !! html -<p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p> +<link rel="mw:PageProp/redirect" href="Category:Foo" title="Category:Foo"/> !! end !! test @@ -7093,7 +7834,7 @@ parsoid !! wikitext #REDIRECT [[en:File:Wiki.png]] !! html -<link rel="mw:PageProp/redirect" href="File:Wiki.png"> +<link rel="mw:PageProp/redirect" href="./File:Wiki.png"> !! end !! test @@ -7103,7 +7844,7 @@ parsoid !! wikitext #REDIRECT [[meatball:File:Wiki.png]] !! html -<link rel="mw:PageProp/redirect" href="File:Wiki.png"> +<link rel="mw:PageProp/redirect" href="./File:Wiki.png"> !! end !! test @@ -7118,14 +7859,26 @@ language=is !! end !! test +Redirect syntax under text isn't considered a redirect +!! wikitext +some text +#redirect [[Main Page]] +!! html/parsoid +<p>some text</p> +<ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol> +!! end + +# FIXME: Should hoist the redirect to the top of the page and ensure there +# is only one. +!! test New redirect !! options parsoid=html2wt +!! html +<p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p> !! wikitext Foo #REDIRECT [[Foo]] -!! html -<p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p> !! end ## @@ -7151,9 +7904,6 @@ Broken br tag sanitization !! end # TODO: Fix html2html mode (bug 51055)! -# This </br> handling was added as part of bug 50831; but it -# differs from how PHP+tidy handles this. We should investigate -# this. !! test Parsoid: Broken br tag recognition !! options @@ -7162,12 +7912,9 @@ parsoid=wt2html </br> <br/ > -!! html/php+tidy -<p></br></p> +!! html+tidy +<p><br /></p> <p><br /></p> -!! html/parsoid -<p><br></p> -<p><br/></p> !! end !! test @@ -7192,6 +7939,8 @@ Failing to transform badly formed HTML into correct XHTML </p> !!end +## FIXME: Is Parsoid's acceptance of self-closing html-tags +## a feature or a bug? See https://phabricator.wikimedia.org/T76962 !! test Handling html with a div self-closing tag !! wikitext @@ -7201,7 +7950,7 @@ Handling html with a div self-closing tag <div title=bar /> <div title=bar/> <div title=bar/ > -!! html +!! html/php <p><div title /> <div title/> </p> @@ -7212,6 +7961,13 @@ Handling html with a div self-closing tag <div title="bar/"></div> </div> +!! html/parsoid +<div title="" data-parsoid='{"stx":"html","selfClose":true}'></div> +<div title="" data-parsoid='{"stx":"html","selfClose":true}'></div> +<div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div> +<div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div> +<div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div> +<div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div> !! end !! test @@ -7234,7 +7990,7 @@ Handling html with a br self-closing tag !! html/parsoid <p><br title="" /> <br title="" /> -<br /> +<br title="" /> <br title="bar" /> <br title="bar" /> <br title="bar/" /> @@ -7248,11 +8004,12 @@ Horizontal ruler (should it add that extra space?) <hr > foo <hr > bar -!! html +!! html+tidy <hr /> <hr /> -foo <hr /> bar - +<p>foo</p> +<hr /> +<p>bar</p> !! end !! test @@ -7462,6 +8219,16 @@ Nested lists 8 (multiple nesting transitions) !! end !! test +Nested lists 9 (extension interaction) +!! options +parsoid +!! wikitext +*<references /> +!! html/parsoid +<ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul> +!! end + +!! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! wikitext *foo @@ -7718,6 +8485,8 @@ Unbalanced closing non-block tags don't break a list !! test Unclosed formatting tags that straddle lists are closed and reopened (php parser relies on Tidy to fix up) +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext # <s> a # b </s> @@ -7727,19 +8496,13 @@ Unclosed formatting tags that straddle lists are closed and reopened <li><s>b</s></li> </ol> !! html/parsoid -<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 -# Parsoid fails this test, but it might be tricky to support properly. # See bug 68395. !!test -List embedded in a non-block tag -(Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy) +1. List embedded in a formatting tag !! wikitext <small> * foo @@ -7756,6 +8519,49 @@ List embedded in a non-block tag </small> !!end +## Ugly Parsoid output here +## Not sure what the right output is. +!!test +2. List embedded in a formatting tag +!! wikitext +<small> +*a +*b</small> +!! html/php+tidy +<ul> +<li><small>a</small></li> +<li><small>b</small></li> +</ul> +!! html/parsoid +<small></small> +<ul><small> +<li>a</li> +</small> +<li><small>b</small></li> +</ul> +!!end + +# Ugly Parsoid and PHP parser output here +# Not sure if we want to make this a test! +# +## !!test +## 3. Unclosed formatting tags in list elements +## !! wikitext +## *<small>a +## *<small>b +## !! html/php+tidy +## <ul> +## <li><small>a</small></li> +## <li><small><small>b</small></small></li> +## </ul> +## !! html/parsoid +## <ul> +## <li><small>a</small></li> +## <small> +## <li><small>b</small></li> +## </small></ul> +## !!end + # This is a bug in the PHP parser + tidy combination. # (The </tr> tag gets parsed as text and html-escaped by PHP, # and then fostered out of the table by tidy.) @@ -7769,14 +8575,7 @@ parsoid=wt2html,wt2wt <td>foo</td> </tr> </table> -!! html/php+tidy -<p></tr></p> -<table> -<tr> -<td>foo</td> -</tr> -</table> -!! html/parsoid +!! html+tidy <table> <tr> <td>foo</td> @@ -8360,6 +9159,23 @@ Aoeu </p> !! end +# From plwiki:PLOS_ONE +!! test +Parsoid: Page property magic word with magic word contents +!! wikitext +{{DISPLAYTITLE:''{{PAGENAME}}''}} +!! html/parsoid +<meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"<i data-parsoid=\"{&quot;dsr&quot;:[15,31,2,2]}\"><span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[]],&quot;dsr&quot;:[17,29,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;PAGENAME&quot;,&quot;function&quot;:&quot;pagename&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}\">Main Page</span></i>"}]]}'/> +!! end + +!! test +Parsoid: Template-generated DISPLAYTITLE +!! wikitext +{{{{echo|DISPLAYTITLE}}:Foo}} +!! html/parsoid +<meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/> +!! end + !! test Namespace 1 {{ns:1}} !! wikitext @@ -8490,10 +9306,10 @@ hi+world%3F%21 Magic Word: prioritize type info over data-parsoid !! options parsoid=html2wt +!! html +<meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/> !! wikitext __FORCETOC__ -!! html -<meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/> !! end !! test @@ -8516,7 +9332,7 @@ language=de !! wikitext __NOEDITSECTION__ !! html -<meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/> +<meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/> !! end ### @@ -8541,6 +9357,28 @@ RFC 822 !! end !! test +Magic links: RFC (bug 65278) +!! wikitext +This is RFC 822 but thisRFC 822 is not RFC 822linked. +!! html +<p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked. +</p> +!! end + +!! test +Magic links: RFC (w/ non-newline whitespace, bug 28950/29025) +!! wikitext +RFC      822 +RFC +822 +!! html +<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> +RFC +822 +</p> +!! end + +!! test Magic links: ISBN (bug 1937) !! wikitext ISBN 0-306-40615-2 @@ -8550,6 +9388,34 @@ ISBN 0-306-40615-2 !! end !! test +Magic links: ISBN (bug 65278) +!! wikitext +This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked. +!! html/php +<p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked. +</p> +!! html/parsoid +<p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p> +!! end + +!! test +Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025) +!! wikitext +ISBN      978 0 316 09811 3 +ISBN +9780316098113 +ISBN 978 +0316098113 +!! html +<p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a> +ISBN +9780316098113 +ISBN 978 +0316098113 +</p> +!! end + +!! test Magic links: PMID incorrectly converts space to underscore !! wikitext PMID 1234 @@ -8558,6 +9424,28 @@ PMID 1234 </p> !! end +!! test +Magic links: PMID (bug 65278) +!! wikitext +This is PMID 1234 but thisPMID 1234 is not PMID 1234linked. +!! html +<p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked. +</p> +!! end + +!! test +Magic links: PMID (w/ non-newline whitespace, bug 28950/29025) +!! wikitext +PMID      1234 +PMID +1234 +!! html +<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> +PMID +1234 +</p> +!! end + ### ### Templates #### @@ -8783,8 +9671,7 @@ Template with complex template as argument !! test Template with thumb image (with link in description) !! wikitext -{{paramtest| - param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} +{{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! html/php This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div> @@ -8795,6 +9682,8 @@ This is a test template with parameter <div class="thumb tright"><div class="thu <div class="thumbcaption"><a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div> </div> </div> +!! html/parsoid +<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure> !! end !! article @@ -8853,15 +9742,6 @@ Template parameter as link source </p> !! end -!!test -Template-generated attribute string (k='v') -!! wikitext -<span {{attr_str|id|v1}}>bar</span> -!! html -<p><span id="v1">bar</span> -</p> -!!end - !!article Template:paramtest2 !! text @@ -9237,19 +10117,15 @@ some <h3><span class="mw-headline" id="here">here</span></h3> !! html/parsoid -<!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/><!-- comment --> -<h2 data-parsoid='{}'> hu </h2> +<!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/><!-- comment --><h2> hu </h2> <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/> +<p>some</p> +<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/><ul><li> stuff</li> +<li> here</li></ul> -<p data-parsoid='{}'>some</p> -<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/> -<ul data-parsoid='{}'> -<li data-parsoid='{}'> stuff</li> - -<li data-parsoid='{}'> here</li></ul> +<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>can have stuff</includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3> -<h3 data-parsoid='{}'> here </h3> !! end # TODO: test with DOM fragment reuse! @@ -9270,25 +10146,17 @@ c}}d b}} !! html -a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b -<table></table>c"}},"i":0}}]}'>b</span> -<table about="#mwt1"></table><span about="#mwt1">c</span>d +<p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b<table></table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p> +<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2"> +</span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2"> +</span><p about="#mwt2">cd</p> -<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2"> -</span> -<table about="#mwt2"></table><span about="#mwt2"> -</span> -<p about="#mwt2">cd</p> - +<p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3"> -<p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3"> - -</span> -<table about="#mwt3"></table><span about="#mwt3"> +</span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3"> -</span> -<p about="#mwt3">b</p> +</span><p about="#mwt3">b</p> !! end !! test @@ -9405,11 +10273,9 @@ parsoid=wt2html,wt2wt |foo |} !!html/parsoid -<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span> -<table width="100%"> -<tbody> -<tr> -<td>foo</td></tr></tbody></table> +<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%"> +<tbody><tr><td>foo</td></tr> +</tbody></table> !!end !!test @@ -9421,7 +10287,7 @@ parsoid=wt2html,wt2wt |c |} !!html/parsoid -<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>a</includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"<span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&quot;dsr&quot;:[31,38,null,null],&quot;src&quot;:&quot;{{{b}}}&quot;}\">{{{b}}}</span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'> +<meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"<span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&quot;dsr&quot;:[31,38,null,null],&quot;src&quot;:&quot;{{{b}}}&quot;}\">{{{b}}}</span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'> <tbody><tr><td>c</td></tr> </tbody></table> @@ -9592,7 +10458,7 @@ Templates: Correctly encapsulate templates producing </p> tag without a correspo b</p>}} !! html/parsoid <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb</p>"}},"i":0}}]}'>a -b</p><p></p> +b</p> !!end !!test @@ -9718,6 +10584,9 @@ Templates: HTML Tag: 6. Generation of end piece of HTML attr value !!end +# SSS FIXME: While it is great we added support for all this, +# do we want to make this part of the spec? Maybe we want to +# deprecate this kind of usage in the future? !!test Templates: HTML Tag: 7. Generation of partial attribute key string !! wikitext @@ -9727,6 +10596,79 @@ Templates: HTML Tag: 7. Generation of partial attribute key string !!end +!! test +Templates: HTML Tag: 8. Template-generated attribute (k=v) +!! wikitext +<div {{echo|1=id="v1"}}>bar</div> +!! html +<div id="v1">bar</div> + +!!end + +!! test +Templates: HTML Tag: 9. Multiple template-generated attributes +!! wikitext +<div {{echo|1=id="v1" title="foo"}}>bar</div> +!! html +<div id="v1" title="foo">bar</div> + +!!end + +!! test +Templates: Support for templates generating attributes and content +!! wikitext +{| {{mixed_attr_content_template}} +|- +|bar +|} +!! html/php +<table style="color:red;" title="T48811"> + +<tr> +<td>foo +</td></tr> +<tr> +<td>bar +</td></tr></table> + +!! html/parsoid +<table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'> +<tbody><tr> +<td>foo</td></tr> +<tr> +<td>bar</td></tr> +</tbody></table> +!!end + +!! test +1. Entities and nowikis inside templated attributes should be handled correctly +!! wikitext +<div {{echo|style{{=}}"background:#f9f9f9;"}}>foo</div> +!! html/php +<div style="background:#f9f9f9;">foo</div> + +!! html/parsoid +<div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[5,49,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;style{{=}}\\&quot;background:&amp;#35;f9f9f9;\\&quot;&quot;}},&quot;i&quot;:0}}]}\">style</span><span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=</span><span about=\"#mwt1\" data-parsoid=\"{}\">\"background:</span><span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&quot;src&quot;:&quot;&amp;#35;&quot;,&quot;srcContent&quot;:&quot;#&quot;}\">#</span><span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"</span>"},{"html":""}]]}'>foo</div> +!! end + +!! test +2. Entities and nowikis inside templated attributes should be handled correctly +!! wikitext +{| +|{{table_attribs_3}} +|} +!! html/php +<table> +<tr> +<td style="background:#f9f9f9;">Foo +</td></tr></table> + +!! html/parsoid +<table> +<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr> +</tbody></table> +!! end + !!test Templates: HTML Tables: 1. Generating start of a HTML table !! wikitext @@ -10700,26 +11642,26 @@ parsoid=wt2html Parsoid: Escape nowiki with trailing space in tags !! options parsoid=html2wt +!! html +<p><nowiki > foo </nowiki ></p> +<p>a<nowiki />b</p> +<p>c<nowiki/ >d</p> !! wikitext <nowiki > foo </nowiki > a<nowiki />b c<nowiki/ >d -!! html -<p><nowiki > foo </nowiki ></p> -<p>a<nowiki />b</p> -<p>c<nowiki/ >d</p> !! end !! test Parsoid: Escape weird noWikI capitalizations !! options parsoid=html2wt -!! wikitext -<noWikI > foo </NoWikI > !! html <p><noWikI > foo </NoWikI ></p> +!! wikitext +<noWikI > foo </NoWikI > !! end ### @@ -10841,8 +11783,7 @@ parsoid=wt2html,wt2wt,html2html <p><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> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span> -</p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -10853,8 +11794,7 @@ Simple image (using File: namespace, now canonical) <p><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> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span> -</p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -10865,7 +11805,7 @@ Right-aligned image <div class="floatright"><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></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> !! end !! test @@ -10876,7 +11816,7 @@ Image with caption <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure> !! end !! test @@ -10887,7 +11827,7 @@ Image with caption, bug 53312 #1 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure> !! end !! test @@ -10898,7 +11838,7 @@ Image with caption, bug 53312 #2 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure> !! end !! test @@ -10909,7 +11849,7 @@ Image with caption, bug 53312 #3 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure> !! end !! test @@ -10925,13 +11865,22 @@ thumbsize=220 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&action=edit&redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&action=edit&redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a> [[]] -<a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a> +<a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a> </figcaption></figure> !! end !! test +Titles in unlinked images (T23454) +!! wikitext +[[File:Foobar.jpg|link=|stuff]] +!! html/php +<p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" /> +</p> +!! end + +!! test Link with empty target !! wikitext [[]] @@ -10941,6 +11890,17 @@ Link with empty target !! end !! test +Image with link trail +!! wikitext +Linktrails should not work for images: [[File:Foobar.jpg]]s +!! html/php +<p>Linktrails should not work for images: <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>s +</p> +!! html/parsoid +<p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p> +!! end + +!! test Image with empty attribute !! options parsoid=wt2html,wt2wt,html2html @@ -10950,7 +11910,7 @@ parsoid=wt2html,wt2wt,html2html <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure> !! end !! test @@ -10961,7 +11921,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;137px&quot;}},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[24,38,null,null]}\">137px</span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure> +<figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[24,38,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;137px&quot;}},&quot;i&quot;:0}}]}\">137px</span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure> !! end !! test @@ -10972,7 +11932,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;thumb&quot;}},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[18,32,null,null]}\">thumb</span>"}],["width",{"html":"<span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;137px&quot;}},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[33,47,null,null]}\">137px</span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure> +<figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[18,32,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;thumb&quot;}},&quot;i&quot;:0}}]}\">thumb</span>"}],["width",{"html":"<span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[33,47,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;137px&quot;}},&quot;i&quot;:0}}]}\">137px</span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure> !! end !! test @@ -10983,7 +11943,7 @@ parsoid=wt2html,wt2wt,html2html <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;50px&quot;}},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[18,31,null,null]}\">50px</span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> +<p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]],&quot;dsr&quot;:[18,31,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;50px&quot;}},&quot;i&quot;:0}}]}\">50px</span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p> !! end ## Parsoid does not provide editing support for images where templates produce multiple image attributes. @@ -10996,10 +11956,9 @@ Image with multiple attributes from the same template <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure> !! end -# Parsoid's output here is broken (incorrect p-wrapping); see bug 64901. !! test Image with link tails !! options @@ -11028,9 +11987,9 @@ thumbsize=220 </div> <p>456</p> !! html/parsoid -<p>123<span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>456</p> -123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>456 -123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220"></a></figure>456 +<p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p> +<p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p> +<p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p> !! end !! test @@ -11041,7 +12000,7 @@ Image with multiple captions -- only last one is accepted <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure> !! end !! test @@ -11052,7 +12011,7 @@ Image with multiple widths -- use last <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></span></p> +<p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p> !! end !! test @@ -11068,8 +12027,8 @@ thumbsize=220 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a> </p> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> -<p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11084,9 +12043,9 @@ Image with width attribute at different positions <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div> !! html/parsoid -<figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure> -<figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure> -<figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>Caption</figcaption></figure> +<figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure> +<figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure> +<figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure> !! end # a sad bit of backward-compatibility @@ -11102,7 +12061,7 @@ parsoid=wt2html,wt2wt,html2html <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p> +<p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p> !! end !! test @@ -11113,7 +12072,7 @@ Image with link parameter, wiki target <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end # parsoid bug 49293 (part 1) @@ -11125,7 +12084,7 @@ Image with link parameter, URL target <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end # parsoid bug 49293 (part 2) @@ -11137,7 +12096,7 @@ Image with link parameter, protocol-less URL target <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11192,7 +12151,7 @@ Image with empty link parameter <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p> +<p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p> !! end !! test @@ -11203,7 +12162,7 @@ Image with link parameter (wiki target) and unnamed parameter <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11214,7 +12173,7 @@ Image with link parameter (URL target) and unnamed parameter <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11228,7 +12187,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure> !! end !! test @@ -11241,7 +12200,7 @@ thumbsize=220 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure> !! end !! test @@ -11255,7 +12214,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure> !! end !! test @@ -11269,7 +12228,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure> !! end !! test @@ -11283,7 +12242,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></span><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure> !! end !! test @@ -11297,7 +12256,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a><figcaption>Title</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure> !! end !! test @@ -11310,7 +12269,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure> !! end !! test @@ -11323,7 +12282,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure> !! end !! test @@ -11339,8 +12298,19 @@ parsoid=wt2html,wt2wt,html2html </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw="{"caption":"testing '''bold''' in alt"}"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> -<p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw="{"caption":"testing '''bold''' in alt"}"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> +!! end + +!! test +Alt image option should handle most kinds of wikitext without barfing +!! wikitext +[[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]] +!! html/php +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div> + +!! html/parsoid +<figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|''bold template''}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a <a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Link&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;link&quot;},&quot;dsr&quot;:[65,73,2,2]}\">link</a> and a <i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;dsr&quot;:[80,106,null,null],&quot;pi&quot;:[[{&quot;k&quot;:&quot;1&quot;,&quot;spc&quot;:[&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;]}]]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''bold template''&quot;}},&quot;i&quot;:0}}]}\">bold template</i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|''bold template''}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure> !! end ################### @@ -11364,9 +12334,9 @@ parsoid=wt2html,wt2wt,html2html </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p> -<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p> -<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p> !! end !! test @@ -11383,7 +12353,9 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -11400,7 +12372,9 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> !! end ################### @@ -11427,8 +12401,8 @@ parsoid=wt2html,wt2wt,html2html </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p> -<p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p> +<p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p> +<p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p> !! end !! test @@ -11444,8 +12418,8 @@ parsoid=wt2html,wt2wt,html2html </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p> -<p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p> +<p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p> +<p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p> !! end !! test @@ -11458,7 +12432,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure> !! end !! test @@ -11474,8 +12448,8 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure> -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure> !! end !! test @@ -11488,7 +12462,7 @@ parsoid=wt2html,wt2wt,html2html <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></span></p> +<p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p> !! end !! test @@ -11504,8 +12478,8 @@ parsoid=wt2html,wt2wt,html2html </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> </p> !! html/parsoid -<p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> -<p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p> +<p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> +<p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p> !! end !! test @@ -11527,7 +12501,10 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure><figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure> +<figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> +<figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> +<figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> +<figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure> !! end ################### @@ -11560,7 +12537,7 @@ Frameless image caption with a free URL <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11573,7 +12550,7 @@ thumbsize=220 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure> !! end !! test @@ -11587,7 +12564,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure> !! end !! test @@ -11599,7 +12576,7 @@ SVG thumbnails with no language set <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="165" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -11612,7 +12589,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" height="165" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -11625,7 +12602,7 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure> !! end !! test @@ -11636,7 +12613,7 @@ BUG 1887: A ISBN with a thumbnail <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure> !! end !! test @@ -11647,7 +12624,7 @@ BUG 1887: A RFC with a thumbnail <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure> !! end !! test @@ -11658,7 +12635,7 @@ BUG 1887: A mailto link with a thumbnail <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure> !! end # Pending resolution to bug 368 @@ -11670,7 +12647,7 @@ BUG 648: Frameless image caption with a link <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11681,7 +12658,7 @@ BUG 648: Frameless image caption with a link (suffix) <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11692,7 +12669,7 @@ BUG 648: Frameless image caption with an interwiki link <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11703,7 +12680,7 @@ BUG 648: Frameless image caption with a piped interwiki link <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11714,7 +12691,7 @@ Escape HTML special chars in image alt text <p><a href="/wiki/File:Foobar.jpg" class="image" title="& < > ""><img alt="& < > "" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"& < > \""}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"& < > \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11725,7 +12702,7 @@ BUG 499: Alt text should have Ӓ, not &1234; <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&#9792;"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&#9792;"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11749,7 +12726,7 @@ Image caption containing another image <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" height="135" width="135"/></a></span> inside it!</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure> !! end !! test @@ -11761,7 +12738,7 @@ Image: caption containing a newline <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !!end !!test @@ -11773,7 +12750,7 @@ Image: caption containing leading space <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure> !!end !! test @@ -11792,7 +12769,7 @@ and some more text.]] <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table <table> <tbody> <tr><th>Foo </th><th>Bar</th></tr> @@ -11809,7 +12786,7 @@ Bug 3090: External links other than http: in image captions <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div> !! html/parsoid -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure> !! end !! test @@ -11822,7 +12799,7 @@ parsoid=wt2html,wt2wt,html2html <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a> </p> !! html/parsoid -<p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p> +<p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -11836,7 +12813,7 @@ language=es <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -11851,7 +12828,7 @@ language=es <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -11865,7 +12842,7 @@ parsoid=wt2html,wt2wt,html2html <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> </p> !! html/parsoid -<p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p> +<p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p> !! end # Note that 'right' is the default alignment, despite the misspelled 'righ' below @@ -11886,7 +12863,9 @@ parsoid=wt2html,wt2wt,html2html <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div> !! html/parsoid -<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> !! end !! article @@ -11895,11 +12874,13 @@ File:Barfoo.jpg #REDIRECT [[File:Barfoo.jpg]] !! endarticle +# FIXME: Parsoid should run this test -- but we'd need to teach the +# mockAPI about the redirected Barfoo.jpg image. !! test Redirected image !! wikitext [[Image:Barfoo.jpg]] -!! html +!! html/php <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a> </p> !! end @@ -11909,10 +12890,12 @@ Missing image with uploads disabled !! options wgEnableUploads=0 !! wikitext -[[Image:Foobaz.jpg]] -!! html +[[File:Foobaz.jpg]] +!! html/php <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a> </p> +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p> !! end # Parsoid-specific testing for images @@ -11927,12 +12910,7 @@ Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|middle|50px]] !! html/parsoid -<p><span class="mw-valign-middle" typeof="mw:Image"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"> -</a> -</span> -</p> +<p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p> !! end !! test @@ -11943,12 +12921,7 @@ parsoid=wt2wt,wt2html,html2html !! wikitext [[Image:Foobar.jpg|middle|50px]] !! html/parsoid -<p><span class="mw-valign-middle" typeof="mw:Image"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"> -</a> -</span> -</p> +<p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p> !! end !! test @@ -11957,7 +12930,7 @@ Parsoid-specific image handling - simple image with size and middle alignment !! wikitext [[File:Foobar.jpg|50px|middle]] !! html/parsoid -<p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> +<p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> !! end !! test @@ -11968,12 +12941,7 @@ parsoid=wt2html,wt2wt,html2html !! wikitext [[Image:Foobar.jpg|50px|middle]] !! html/parsoid -<p><span class="mw-valign-middle" typeof="mw:Image"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50"> -</a> -</span> -</p> +<p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p> !! end !! test @@ -11981,7 +12949,7 @@ Parsoid-specific image handling - simple image with both sizes, a baseline align !! wikitext [[File:Foobar.jpg|500x10px|baseline|caption]] !! html/parsoid -<p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> +<p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> !! end !! test @@ -11989,7 +12957,7 @@ Parsoid-specific image handling - simple image with border and size spec !! wikitext [[File:Foobar.jpg|50px|border|caption]] !! html/parsoid -<p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> +<p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> !! end !! test @@ -11997,12 +12965,7 @@ Parsoid-specific image handling - thumbnail with halign, valign, and caption !! wikitext [[File:Foobar.jpg|left|baseline|thumb|caption content]] !! html/parsoid -<figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" /> -</a> -<figcaption>caption content</figcaption> -</figure> +<figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure> !! end !! test @@ -12011,7 +12974,7 @@ Parsoid-specific image handling - thumbnail with halign, valign, and caption !! wikitext [[File:Foobar.jpg|thumb|left|baseline|caption content]] !! html/parsoid -<figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure> +<figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure> !! end !! test @@ -12019,12 +12982,7 @@ Parsoid-specific image handling - thumbnail with specific size, halign, valign, !! wikitext [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]] !! html/parsoid -<figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" /> -</a> -<figcaption>caption</figcaption> -</figure> +<figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -12033,7 +12991,7 @@ valign, and caption (existing content) !! wikitext [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]] !! html/parsoid -<figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure> +<figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -12044,12 +13002,7 @@ parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|frame|500x50px|caption]] !! html/parsoid -<figure typeof="mw:Image/Frame"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /> -</a> -<figcaption>caption</figcaption> -</figure> +<figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -12060,12 +13013,7 @@ parsoid=wt2html,wt2wt,html2html !! wikitext [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]] !! html/parsoid -<figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /> -</a> -<figcaption>caption</figcaption> -</figure> +<figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -12073,7 +13021,7 @@ Parsoid-specific image handling - frameless image with specific size, border, an !! wikitext [[File:Foobar.jpg|frameless|442x50px|border|caption]] !! html/parsoid -<p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> +<p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p> !! end !! test @@ -12081,10 +13029,7 @@ Parsoid-specific image handling - simple image with a formatted caption !! wikitext [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]] !! html/parsoid -<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>"}'> -<a href="File:Foobar.jpg"> -<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"> -</a></span></p> +<p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !! end !! test @@ -12092,7 +13037,7 @@ Parsoid-specific image handling - caption with a template in it !! wikitext [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]] !! html/parsoid -<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}">transclusion</span> in it.</figcaption></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}">transclusion</span> in it.</figcaption></figure> !! end !! test @@ -12105,7 +13050,7 @@ foo bar !! html/parsoid <p>foo</p> -<figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure> <p>bar</p> !! end @@ -12116,7 +13061,7 @@ parsoid=wt2html,wt2wt !! wikitext [[File:Foobar.jpg|thumb|]] !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure> !! end # empty captions don't get serialized unless we're in the "round trip" case @@ -12126,9 +13071,10 @@ Parsoid-specific image handling - empty caption (2) parsoid=html2wt !! html/parsoid <figure class="mw-default-size" typeof="mw:Image/Thumb"> - <a href="File:Foobar.jpg"> + <a href="./File:Foobar.jpg"> <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" + data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/> </a> <figcaption></figcaption> @@ -12142,7 +13088,7 @@ Parsoid-specific image handling - whitespace caption !! wikitext [[File:Foobar.jpg|thumb| ]] !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> </figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure> !! end !! test @@ -12153,7 +13099,7 @@ foo bar !! html/parsoid <p>foo -<span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" height="180" width="240"/></a></span> +<span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span> bar</p> !! end @@ -12189,7 +13135,12 @@ subpage title=[[Subpage test]] </p> !! end -# TODO: make this PHP-parser compatible! +!! article +Subpage test/1/2/subpage +!! text +blah +!! endarticle + !! test Relative subpage noslash link !! options @@ -12199,8 +13150,12 @@ subpage title=[[Subpage test/1/2/3/4]] [[../../subpage/]] [[../../subpage]] -!! html -<p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p> +!! html/php +<p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a> +</p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p> <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p> !! end @@ -12273,8 +13228,28 @@ Render invalid page names as plain text (bug 51090) [[foo<bar]] </p> !!html/parsoid -<p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p> -<p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<bar"}},"i":0}}]}'>foo<bar</span>]]</p> +<p>[[./../foo|bar]] +[[foo�|bar]] +[[foo/.|bar]] +[[foo/..|bar]] +[[foo~~~bar]] +[[foo>bar]] +[[foo[bar]] +[[.]] +[[..]] +[[foo././bar]]</p> + +<p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]] +[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<bar"}},"i":0}}]}'>foo<bar</span>]]</p> !!end !! test @@ -12496,8 +13471,8 @@ parsoid [[:File:Foo.png|Bar]] !! html <p> -<a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a> -<a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a> +<a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a> +<a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a> </p> !! end @@ -12514,15 +13489,31 @@ parsoid !! end !! test -Parsoid: Defaultsort +Normalize hrefs properly before testing for invalid link targets (bug 70894) !! options -parsoid +parsoid=html2wt +!! html +<link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/> +!! wikitext +[[Category:Toxine bactérienne]] +!! end + +!! test +Parsoid: Defaultsort !! wikitext {{DEFAULTSORT:Foo}} -!! html +!! html/parsoid <meta property="mw:PageProp/categorydefaultsort" content="Foo"/> !! end +!! test +Parsoid: Defaultsort (template-generated) +!! wikitext +{{{{echo|DEFAULTSORT}}:Foo}} +!! html/parsoid +<meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/> +!! end + ### ### Inter-language links ### @@ -12537,9 +13528,9 @@ ill !! html/php es:Alimento fr:Nourriture zh:食品 !! html/parsoid -<p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/> -<link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/> -<link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/> +<link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/> +<link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/> !! end !! test @@ -12554,10 +13545,10 @@ ill !! html/php es:1 fr:1 !! html/parsoid -<p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/> -<link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/> -<link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/> -<link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/> +<link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/> +<link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/> !! end ### @@ -12631,6 +13622,31 @@ Some text !! end +!! test +TOC anchors don't collide +!! wikitext +__FORCETOC__ +== Headline 2 == +== Headline == +== Headline 2 == +== Headline == +!! html +<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li> +<li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li> +<li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li> +<li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li> +</ul> +</div> + +<h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2> + +!! end + # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' !! test Handling of sections up to level 6 and beyond @@ -12690,7 +13706,7 @@ Handling of sections up to level 6 and beyond !! end !! test -TOC regression (bug 9764) +TOC regression (T11764) !! wikitext == title 1 == === title 1.1 === @@ -12862,7 +13878,7 @@ Link inside a section heading !! end !! test -TOC regression (bug 12077) +TOC regression (T14077) !! wikitext __TOC__ == title 1 == @@ -12889,10 +13905,12 @@ __TOC__ !! test BUG 1219 URL next to image (good) !! wikitext -http://example.com [[Image:foobar.jpg]] -!! html +http://example.com [[File:Foobar.jpg]] +!! html/php <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <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> </p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !!end !! test @@ -13115,10 +14133,12 @@ c3--> !! test BUG 1219 URL next to image (broken) !! wikitext -http://example.com[[Image:foobar.jpg]] -!! html +http://example.com[[File:Foobar.jpg]] +!! html/php <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><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> </p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p> !!end !! test @@ -13237,15 +14257,14 @@ parsoid </tbody></table> !! end -# The PHP parser escapes the opening brace to { for some reason, so -# disabled this test for it. !! test div with braces in attribute value -!! options -parsoid !! wikitext <div title="{}">Foo</div> -!! html +!! html/php +<div title="{}">Foo</div> + +!! html/parsoid <div title="{}">Foo</div> !! end @@ -13254,17 +14273,19 @@ parsoid # 'div with empty attribute value, space before equals'), but strips the # attribute completely if the space is missing. We hope that not much content # depends on this, so are implementing the behavior below in Parsoid for -# consistencies' sake. Disabled for the PHP parser. +# consistencies' sake. # FIXME: fix this behavior in the PHP parser? !! test div with empty attribute value, no space before equals !! options -parsoid +parsoid=wt2html,html2html !! wikitext <div class=>HTML rocks</div> -!! html -<div class="">HTML rocks</div> +!! html/php +<div>HTML rocks</div> +!! html/parsoid +<div class="">HTML rocks</div> !! end !! test @@ -13482,16 +14503,17 @@ Media link with text !! end # FIXME: this is still bad HTML tag nesting +# FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div !! test Media link with nasty text -fixme: doBlockLevels won't wrap this in a paragraph because it contains a div !! wikitext [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]] !! html <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a> !! html+tidy -<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a></p> +<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p> +<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div> !! end !! test @@ -13506,19 +14528,23 @@ Media link to nonexistent file (bug 1702) !! test Image link to nonexistent file (bug 1850 - good) !! wikitext -[[Image:No such.jpg]] -!! html +[[File:No_such.jpg]] +!! html/php <p><a href="/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a> </p> +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p> !! end !! test :Image link to nonexistent file (bug 1850 - bad) !! wikitext [[:Image:No such.jpg]] -!! html +!! html/php <p><a href="/index.php?title=File:No_such.jpg&action=edit&redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p> !! end @@ -13685,7 +14711,7 @@ Bug 2304: HTML attribute safety (dangerous template; 2309) <div title=""></div> !! html/parsoid -<div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;dangerous attribute&quot;,&quot;href&quot;:&quot;./Template:Dangerous_attribute&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}\" data-parsoid=\"{&quot;pi&quot;:[[]],&quot;dsr&quot;:[12,35,null,null]}\">\" onmouseover=\"alert(document.cookie)</span>"}]]}' data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}'></div> +<div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&quot;pi&quot;:[[]],&quot;dsr&quot;:[12,35,null,null]}\" data-mw=\"{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;dangerous attribute&quot;,&quot;href&quot;:&quot;./Template:Dangerous_attribute&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)</span>"}]]}'></div> !! end !! test @@ -14005,9 +15031,12 @@ Expansion of multi-line templates in attribute values (bug 6255 sanity check) !! wikitext <div style="background: #00FF00">-</div> -!! html +!! html/php <div style="background: #00FF00">-</div> +!! html/parsoid +<div style="background: +#00FF00">-</div> !! end !! test @@ -14245,6 +15274,10 @@ Nested template calls ### ### Sanitizer ### + +# HTML+Tidy effectively strips out the empty tags completely +# But since Parsoid doesn't it wraps the <s></s> tags in p-tags +# which Tidy would have done for the PHP parser had there been content inside it. !! test Sanitizer: Closing of open tags !! wikitext @@ -14252,6 +15285,8 @@ Sanitizer: Closing of open tags !! html <s></s><table></table> +!! html/parsoid +<p><s></s></p><table></table> !! end !! test @@ -14290,16 +15325,19 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id= </p> !! end +# In HTML5, the restrictions are that id must contain at least one character, +# and must not contain any space characters. !! test Sanitizer: Validating the contents of the id attribute (bug 4515) !! options disabled !! wikitext -<br id=9 /> +<br id="" /><br id="a space" /> !! html -Something, but definitely not <br id="9" />... +Something ... !! end +# In HTML5, id must be unique amongst all the ids in the element's home subtree. !! test Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301) !! options @@ -14397,7 +15435,6 @@ Punctuation: CSS ! important (bug 11874; with space after) !!end - !! test HTML bullet list, closed tags (bug 5497) !! wikitext @@ -14405,29 +15442,36 @@ HTML bullet list, closed tags (bug 5497) <li>One</li> <li>Two</li> </ul> -!! html +!! html/php <ul> <li>One</li> <li>Two</li> </ul> +!! html/parsoid +<ul data-parsoid='{"stx":"html"}'> +<li data-parsoid='{"stx":"html"}'>One</li> +<li data-parsoid='{"stx":"html"}'>Two</li> +</ul> + !! end !! test HTML bullet list, unclosed tags (bug 5497) -!! options -disabled !! wikitext <ul> <li>One <li>Two </ul> -!! html +!! html/php+tidy <ul> -<li>One -</li> -<li>Two -</li> +<li>One</li> +<li>Two</li> +</ul> +!! html/parsoid +<ul data-parsoid='{"stx":"html"}'> +<li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li> +<li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li> </ul> !! end @@ -14439,29 +15483,37 @@ HTML ordered list, closed tags (bug 5497) <li>One</li> <li>Two</li> </ol> -!! html +!! html/php <ol> <li>One</li> <li>Two</li> </ol> +!! html/parsoid +<ol data-parsoid='{"stx":"html"}'> +<li data-parsoid='{"stx":"html"}'>One</li> +<li data-parsoid='{"stx":"html"}'>Two</li> +</ol> + !! end !! test HTML ordered list, unclosed tags (bug 5497) !! options -disabled !! wikitext <ol> <li>One <li>Two </ol> -!! html +!! html/php+tidy <ol> -<li>One -</li> -<li>Two -</li> +<li>One</li> +<li>Two</li> +</ol> +!! html/parsoid +<ol data-parsoid='{"stx":"html"}'> +<li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li> +<li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li> </ol> !! end @@ -14493,8 +15545,6 @@ HTML nested bullet list, closed tags (bug 5497) !! test HTML nested bullet list, open tags (bug 5497) -!! options -disabled !! wikitext <ul> <li>One @@ -14504,7 +15554,17 @@ disabled <li>Sub-two </ul> </ul> -!! html +!! html/php+tidy +<ul> +<li>One</li> +<li>Two: +<ul> +<li>Sub-one</li> +<li>Sub-two</li> +</ul> +</li> +</ul> +!! html/parsoid <ul> <li>One </li> @@ -14547,8 +15607,6 @@ HTML nested ordered list, closed tags (bug 5497) !! test HTML nested ordered list, open tags (bug 5497) -!! options -disabled !! wikitext <ol> <li>One @@ -14558,7 +15616,17 @@ disabled <li>Sub-two </ol> </ol> -!! html +!! html/php +<ol> +<li>One +<li>Two: +<ol> +<li>Sub-one +<li>Sub-two +</ol> +</ol> + +!! html/parsoid <ol> <li>One </li> @@ -14659,6 +15727,7 @@ http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div> <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li> </ul> </div> +<p></p> !! end !! test @@ -14798,32 +15867,38 @@ Fuzz testing: Parser25 (bug 6055) Fuzz testing: URL adjacent extension (with space, clean) !! wikitext http://example.com <nowiki>junk</nowiki> -!! html +!! html/php <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk </p> -!!end +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p> +!! end !!test Fuzz testing: URL adjacent extension (no space, dirty; nowiki) !! wikitext http://example.com<nowiki>junk</nowiki> -!! html +!! html/php <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk </p> -!!end +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p> +!! end !!test Fuzz testing: URL adjacent extension (no space, dirty; pre) !! wikitext http://example.com<pre>junk</pre> -!! html +!! html/php <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre> -!! html+tidy +!! html/php+tidy <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p> <pre> junk </pre> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre> !!end !!test @@ -14834,7 +15909,7 @@ Fuzz testing: image with bogus manual thumbnail <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div> !! html/parsoid -<meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/> +<figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure> !!end !! test @@ -14912,15 +15987,19 @@ New wiki paragraph </p> !! end +# FIXME: The current php output is documented +# and desired output is the parsoid target. !! test Inline HTML vs wiki block nesting -!! options -disabled !! wikitext <b>Bold paragraph New wiki paragraph -!! html +!! html/php +<p><b>Bold paragraph +</p><p>New wiki paragraph</b> +</p> +!! html/parsoid <p><b>Bold paragraph</b> </p><p>New wiki paragraph </p> @@ -15913,6 +16992,17 @@ Special:Search page linking. !! end !! test +{{!}} is a magic word +!! wikitext +{{!}} is a magic word there and {{!}} is still a magic word here +!! html/php +<p>| is a magic word there and | is still a magic word here +</p> +!! html/parsoid +<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p> +!! end + +!! test Say the magic word !! options title=[[Parser test]] @@ -16025,8 +17115,8 @@ image4 |300px| centre Gallery (with options) !! wikitext <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' > -File:Nonexistant.jpg|caption -File:Nonexistant.jpg +File:Nonexistent.jpg|caption +File:Nonexistent.jpg image:foobar.jpg|some '''caption''' [[Main Page]] image:foobar.jpg image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. @@ -16035,31 +17125,31 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla. <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;"> <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> - <div class="thumb" style="height: 70px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 70px;">Nonexistent.jpg</div> <div class="gallerytext"> <p>caption </p> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> - <div class="thumb" style="height: 70px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 70px;">Nonexistent.jpg</div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> - <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div> + <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a> </p> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> - <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div> + <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 105px"><div style="width: 105px"> - <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div> + <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>Blabla|blabla. </p> @@ -16080,17 +17170,17 @@ image:foobar.jpg|link=Main Page#section|caption !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>caption </p> @@ -16110,14 +17200,14 @@ File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>This is a test template </p> @@ -16131,30 +17221,30 @@ File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt gallery (with showfilename option) !! wikitext <gallery showfilename> -File:Nonexistant.jpg|caption -File:Nonexistant.jpg +File:Nonexistent.jpg|caption +File:Nonexistent.jpg image:foobar.jpg|some '''caption''' [[Main Page]] File:Foobar.jpg </gallery> !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="height: 150px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 150px;">Nonexistent.jpg</div> <div class="gallerytext"> -<p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> +<p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br /> caption </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="height: 150px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 150px;">Nonexistent.jpg</div> <div class="gallerytext"> -<p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> +<p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br /> </p> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a> @@ -16162,7 +17252,7 @@ some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> </p> @@ -16176,30 +17266,30 @@ some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a> Gallery (with namespace-less filenames) !! wikitext <gallery> -File:Nonexistant.jpg -Nonexistant.jpg +File:Nonexistent.jpg +Nonexistent.jpg image:foobar.jpg foobar.jpg </gallery> !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="height: 150px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 150px;">Nonexistent.jpg</div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="height: 150px;">Nonexistant.jpg</div> + <div class="thumb" style="height: 150px;">Nonexistent.jpg</div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> @@ -16267,6 +17357,8 @@ ISBN 978-0-1234-56 789 </p> !! html+tidy <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p> +!! html/parsoid +<p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&#x20;","srcContent":" "}'> </span>789</p> !! end !! test @@ -16282,24 +17374,37 @@ ISBN Double ISBN !! wikitext ISBN ISBN 1234567890 -!! html +!! html/php <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> </p> +!! html/parsoid +<p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p> !! end !! test ISBN with an X !! wikitext ISBN 3-462-04561-X -!! html +ISBN 080442957X +ISBN 978080442957X +!! html/php <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a> +<a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a> +<a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a> </p> +!! html/parsoid +<p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a> +<a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a> +<a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p> !! end !! test ISBN with empty prefix (parsoid test) !! wikitext ISBN 1234567890 +!! html/php +<p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> +</p> !! html/parsoid <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p> !! end @@ -16308,9 +17413,11 @@ ISBN 1234567890 Bug 22905: <abbr> followed by ISBN followed by </a> !! wikitext <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com] -!! html +!! html/php <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a> </p> +!! html/parsoid +<p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p> !! end !! test @@ -16402,9 +17509,11 @@ Image with page parameter djvu !! wikitext [[File:LoremIpsum.djvu|page=2]] -!! html +!! html/php <p><a href="/index.php?title=File:LoremIpsum.djvu&page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a> </p> +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p> !! end !! test @@ -16416,35 +17525,16 @@ Another italics / bold test </pre> !!end -# Note the results may be incorrect, as parserTest output included this: -# XML error: Mismatched tag at byte 6120: -# ...<dd> </dt></dl> </dd... +# FIXME: The php output seems broken. It's interleaving some open/close tags. !! test dt/dd/dl test -!! options -disabled !! wikitext :;;;:: -!! html -<dl> -<dd><dl> -<dt><dl> -<dt><dl> -<dt><dl> -<dd><dl> -<dd> -</dd> -</dl> -</dd> -</dl> -</dt> -</dl> -</dt> -</dl> -</dt> -</dl> -</dd> -</dl> +!! html/php +<dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl> + +!! html/parsoid +<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 @@ -16458,7 +17548,7 @@ Images with the "|" character in the comment <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&param2=%7Cx">external</a> URL</div></div></div> !! html/parsoid -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&param2=|x">external</a> URL</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&param2=|x">external</a> URL</figcaption></figure> !! end !! test @@ -16538,7 +17628,7 @@ subpage title=[[Subpage test/L1/L2/L3]] !! wikitext [[../../////]] !! html -<p><a href="/index.php?title=Subpage_test/L1////&action=edit&redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a> +<p><a href="/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a> </p> !! end @@ -16587,7 +17677,7 @@ Definition list code coverage ; title : def ; title : def ;title: def -!! html +!! html/php <dl><dt> title  </dt> <dd> def</dd> <dt> title </dt> @@ -16595,6 +17685,10 @@ Definition list code coverage <dt>title</dt> <dd> def</dd></dl> +!! html/parsoid +<dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd> +<dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd> +<dt>title</dt><dd> def</dd></dl> !! end !! test @@ -17051,7 +18145,7 @@ language=sr variant=sr-ec !! wikitext == -{Naslov}- == !! html -<h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Уреди одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2> !! end @@ -17277,45 +18371,51 @@ language=sr variant=sr-ec </p> !! end -# This test is currently broken in the PHP parser (bug 52661) +# FIXME: This test is currently broken in the PHP parser (bug 52661) !! test Don't break image parsing if language converter markup is in the caption. !! options language=sr -disabled !! wikitext [[File:Foobar.jpg|-{R|caption}-]] -!! html +!! html/parsoid <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! end -# This test is currently broken in the PHP parser (bug 52661) +# FIXME: This test is currently broken in the PHP parser (bug 52661) !! test Don't break list handling if language converter markup is in the item. !! options language=zh variant=zh-cn -disabled !! wikitext ;-{zh-cn:AAA;zh-tw:BBB}- -!! html +!! html/php +<dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl> + +!! html/parsoid <dl><dt>AAA </dt></dl> - !! end -# This test is currently broken in the PHP parser (bug 52661) +# FIXME: This test is currently broken in the PHP parser (bug 52661) !! test Don't break table handling if language converter markup is in the cell. !! options language=sr variant=sr-ec -disabled !! wikitext {| |- | -{R|B}- |} -!! html +!! html/php +<table> + +<tr> +<td>Б}- +</td></tr></table> + +!! html/parsoid <table> <tr> @@ -17534,12 +18634,13 @@ Line two !! test Nesting tags, paragraphs on lines which begin with <div> -!! options -disabled !! wikitext <div></div><strong>A B</strong> -!! html +!! html/php+tidy +<p><strong>A</strong></p> +<p><strong>B</strong></p> +!! html/parsoid <div></div> <p><strong>A B</strong> @@ -17941,27 +19042,35 @@ comment <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a> !! end +# Parsoid doesn't support this yet: see bug 73581 +# but it *should* omit the 'src' attribute if the image is bad. +# PHP side of tests was disabled in +# mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c +# because of issues in the PHP parserTests infrastructure +# (but the output below is indeed what the PHP side emits) !! test Bad images - basic functionality -!! options -disabled !! wikitext [[File:Bad.jpg]] -!! html +!! DISABLED/html/php +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p> !! end !! test Bad images - bug 16039: text after bad image disappears -!! options -disabled !! wikitext Foo bar [[File:Bad.jpg]] Bar foo -!! html +!! DISABLED/html/php <p>Foo bar </p><p>Bar foo </p> +!! html/parsoid +<p>Foo bar +<span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span> +Bar foo</p> !! end !! test @@ -18097,6 +19206,82 @@ this is not the the title !! end !! test +Page status indicators: Empty name is invalid +!! options +showindicators +!! wikitext +<indicator name=" "></indicator> +<indicator></indicator> +!! html +<p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span> +<span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span> +</p> +!! end + +!! test +Page status indicators: Weird syntaxes that are okay +!! options +showindicators +!! wikitext +<indicator name="empty" /> +<indicator name></indicator> +!! html +empty= +name= +<p><br /> +</p> +!! end + +!! test +Page status indicators: Torture test +!! options +showindicators +!! wikitext +<indicator name="01">hello world</indicator> +<indicator name="02">[[Main Page]]</indicator> +<indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator> +<indicator name="04">[[File:Foobar.jpg|25px]]</indicator> +<indicator name="05">* foo +* bar</indicator> +<indicator name="06"><nowiki>foo</nowiki></indicator> +<indicator name="07"> Preformatted</indicator> +<indicator name="08"><div>Broken tag</indicator> +<indicator name="09">{| class=wikitable +| cell +|}</indicator> +<indicator name="10">Two + +paragraphs</indicator> +!! html +01=hello world +02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a> +03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /> +04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a> +05=<ul><li> foo</li> +<li> bar</li></ul> + +06=foo +07=<pre>Preformatted +</pre> +08=<div>Broken tag</div> + +09=<table class="wikitable"> +<tr> +<td> cell +</td></tr></table> + +10=<p>Two +</p><p>paragraphs +</p> +<p><br /> +</p><p><br /> +</p><p><br /> +</p><p><br /> +</p><p><br /> +</p> +!! end + +!! test preload: check <noinclude> and <includeonly> !! options preload @@ -18138,18 +19323,22 @@ preload !! test Play a bit with r67090 and bug 3158 -!! options -disabled !! wikitext <div style="width:50% !important"> </div> <div style="width:50% !important"> </div> <div style="width:50% !important"> </div> <div style="border : solid;"> </div> -!! html -<div style="width:50% !important"> </div> -<div style="width:50% !important"> </div> -<div style="width:50% !important"> </div> -<div style="border : solid;"> </div> +!! html/php +<div style="width:50% !important"> </div> +<div style="width:50% !important"> </div> +<div style="width:50% !important"> </div> +<div style="border : solid;"> </div> + +!! html/parsoid +<div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div> +<div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div> +<div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div> +<div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div> !! end @@ -18170,14 +19359,16 @@ percent-encoding and + signs in internal links (Bug 26410) !! wikitext [[User:+%]] [[Page+title%]] [[%+]] [[%+|%20]] [[%+ ]] [[%+r]] -[[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]] +[[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]] [[%33%45]] [[%33%45+]] -!! html +!! html/php <p><a href="/index.php?title=User:%2B%25&action=edit&redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&action=edit&redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a> <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&action=edit&redlink=1" class="new" title="%+r (page does not exist)">%+r</a> <a href="/index.php?title=%25&action=edit&redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&action=edit&redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a> <a href="/index.php?title=3E&action=edit&redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&action=edit&redlink=1" class="new" title="3E+ (page does not exist)">3E+</a> </p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="./File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p> !! end !! test @@ -18185,13 +19376,15 @@ Special characters in embedded file links (bug 27679) !! wikitext [[File:Contains & ampersand.jpg]] [[File:Does not exist.jpg|Title with & ampersand]] -!! html +!! html/php <p><a href="/index.php?title=Special:Upload&wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains & ampersand.jpg">File:Contains & ampersand.jpg</a> <a href="/index.php?title=Special:Upload&wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with & ampersand</a> </p> +!! html/parsoid +<p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&_ampersand.jpg"><img resource="./File:Contains_&_ampersand.jpg" src="./Special:FilePath/Contains_&_ampersand.jpg" height="220" width="220"/></a></span> +<span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with & ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p> !! end - !! test Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4) !! wikitext @@ -18383,6 +19576,7 @@ __TOC__ <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&action=edit&section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2> !! html+tidy +<p></p> <div id="toc" class="toc"> <div id="toctitle"> <h2>Contents</h2> @@ -18391,6 +19585,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> +<p></p> <h2><span class="mw-headline" id="Quote"></span></h2> <blockquote> <p><span class="mw-headline" id="Quote">Quote</span></p> @@ -18439,6 +19634,7 @@ __TOC__ <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&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2> !! html+tidy +<p></p> <div id="toc" class="toc"> <div id="toctitle"> <h2>Contents</h2> @@ -18448,6 +19644,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> +<p></p> <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&action=edit&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></span></h2> <blockquote> @@ -18508,6 +19705,53 @@ __TOC__ !! end +!! test +Bug 72884: bdi element in ToC +!! wikitext +__TOC__ +== <bdi>test</bdi> == +!! html +<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li> +</ul> +</div> + +<h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2> + +!! end + +# Note that the html output does not have the <p></p>, but the +# html+tidy output *does*. This is because the empty <p></p> is +# removed by the sanitizer, but only when tidy is *not* enabled (!). +!! test +Empty <p> tag in TOC, removed by Sanitizer (T92892) +!! wikitext +__TOC__ +== x == +!! html +<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li> +</ul> +</div> + +<h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2> + +!! html+tidy +<p></p> +<div id="toc" class="toc"> +<div id="toctitle"> +<h2>Contents</h2> +</div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li> +</ul> +</div> +<p></p> +<h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2> +!! end + !! article MediaWiki:Bug32057 !! text @@ -18677,7 +19921,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>caption </p> @@ -18696,7 +19940,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>caption </p> @@ -18715,7 +19959,7 @@ File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascri !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> <p>caption </p> @@ -18734,7 +19978,7 @@ File:foobar.jpg|link=< !! html <ul class="gallery mw-gallery-traditional"> <li class="gallerybox" style="width: 155px"><div style="width: 155px"> - <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div> <div class="gallerytext"> </div> </div></li> @@ -18858,13 +20102,13 @@ parsoid=wt2html,wt2wt #### Parsoid-specific functionality tests #### ----------------------------------------------------------------- -# Bug 63642: Formatting elt fixup is cleaned up. +# Bug 63642/66749: Formatting elt fixup around images is cleaned up. # We know wt2wt will fail, but we expect selser to pass. # Due to the nature of our testing, wt2wt and selser tests will enter the # blacklist and we'll catch selser regressions based on changes to the # blacklist entries for selser tests. !! test -Bad treebuilder fixup of formatting elt is cleaned up +1. Bad treebuilder fixup of formatting elt is cleaned up !! options parsoid=wt2html,wt2wt !! wikitext @@ -18877,12 +20121,28 @@ parsoid=wt2html,wt2wt !! html/parsoid <table> <tbody><tr><td> -<p><small></small></p> -<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption><small>Test</small></figcaption></figure> -<p></p></td></tr> +<small> +<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure> +</small> +</td></tr> </tbody></table> !! end +!! test +2. Bad treebuilder fixup of formatting elt is cleaned up +!! options +parsoid=wt2html,wt2wt +!! wikitext +'''foo[[File:Foobar.jpg|thumb|caption]]bar''' + +<small>[[Image:Foobar.jpg|right|300px]]</small> +!! html/parsoid +<p><b>foo</b></p> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure> +<p><b>bar</b></p> +<small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small> +!! end + #### ---------------------------------------------------------------- #### Parsoid-only testing of Parsoid's impl of <ref> and <references> #### tags. Parsoid's output for these tags differs from that of the @@ -18897,10 +20157,16 @@ parsoid A <ref>foo</ref> B <ref name="x">foo</ref> C <ref name="y" /> +<references /> !! html -<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 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span> -C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span> +C <span about="#mwt6" class="reference" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3">[3]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> +<li about="#cite_note-x-2" id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li> +<li about="#cite_note-y-3" id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li> +</ol> !!end !!test @@ -18910,9 +20176,13 @@ parsoid !! wikitext A <ref name="x">foo</ref> B <ref name="x" /> +<references /> !! html -<p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span> -B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li> +</ol> !!end !!test @@ -18923,21 +20193,29 @@ parsoid A <ref name="x">foo</ref> B <ref name=" x " /> C <ref name= x /> +<references /> !! html -<p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span> -B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span> -C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span> +C <span about="#mwt6" class="reference" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a> <a href="#cite_ref-x_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li> +</ol> !!end +# NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly) !!test Ref: 4. 'constructor' should be accepted as a valid ref-name -(NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly) !!options parsoid !! wikitext A <ref name="constructor">foo</ref> +<references /> !! html -<p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-constructor-1" id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li> +</ol> !!end !!test @@ -18951,11 +20229,11 @@ A <ref> <references /> !! html -<p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid='{\"dsr\":[19,40,3,3]}'><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}'>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}}]}' data-parsoid='{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}'>transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> -<ol class="references" typeof="mw:Extension/references" about="#mwt4" 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" title="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 class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="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> +</span></li> </ol> !!end @@ -18972,13 +20250,13 @@ A <ref> <references /> !! html -<p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> -<ol class="references" typeof="mw:Extension/references" about="#mwt3" 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 +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar baz -</li> +</span></li> </ol> !!end @@ -19002,10 +20280,10 @@ booz <references /> !! html -<p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></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 +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar @@ -19015,7 +20293,7 @@ baz booz -</li> +</span></li> </ol> !!end @@ -19028,9 +20306,9 @@ A <ref> foo {{echo|</ref> B C}} <references /> !! html -<p>A <span class="reference" data-mw="{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid='{\"src\":\"{{\",\"dsr\":[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 class="references" typeof="mw:Extension/references" data-mw="{"name":"references","attrs":{}}"> -<li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li> </ol> !!end @@ -19042,9 +20320,9 @@ parsoid A <ref> foo <!--</ref> B C <references /> !! html -<p>A <span 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 class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'> -<li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li> </ol> !!end @@ -19057,11 +20335,11 @@ A <ref> <b> foo </ref> B C <references /> !! html -<p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}'> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref> <b> foo </ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p> -<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"<references />"}' data-mw='{"name":"references","attrs":{}}'> -<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li> </ol> !!end @@ -19072,9 +20350,14 @@ parsoid !! wikitext A <ref>foo</ref> B C <ref>bar</ref> D +<references /> !! html -<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" data-parsoid='{"src":"<ref>foo</ref>"}'><a href="#cite_note-1">[1]</a></span> B -C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bar</ref>"}'><a href="#cite_note-2">[2]</a></span> D</p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B +C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p> +<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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li> +</ol> !!end !!test @@ -19088,15 +20371,18 @@ b<!--the newline at the end of this line stays inside the p-tag--> <ref /> <ref /> c +<references /> !! html <p><!--the newline at the end of this line moves out of the p-tag-->a</p> -<p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> -<span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p> - +<p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span> +<span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p> <p>c</p> +<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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol> !!end !!test @@ -19107,9 +20393,15 @@ parsoid <ref>foo</ref> A <ref>bar </ref> B +<references /> !! html -<p><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> A -<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p> +<p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A +<span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p> +<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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar +</span></li> +</ol> !!end !!test @@ -19121,10 +20413,10 @@ parsoid <references /> !! html -<p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;ref>bar&lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>foo <ref>bar</ref> baz</ref>"}'><a href="#cite_note-1">[1]</a></span></p> - -<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"<references />"}' data-mw='{"name":"references","attrs":{}}'> -<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <ref>bar</ref> baz</li> +<p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> +</p> +<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <ref>bar</ref> baz</span></li> </ol> !!end @@ -19138,10 +20430,10 @@ B1 <ref name="b" /> B2 <ref name="b">bar</ref> <references /> !! html -<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> +<p>A1 <span about="#mwt3" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> +B1 <span about="#mwt7" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><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 class="references" typeof="mw:Extension/references" about="#mwt10" 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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></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> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li> </ol> !!end @@ -19155,10 +20447,78 @@ A <ref >foo</ref > <references /> !! html -<p>A <span 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> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol> +!!end + +!!test +Ref: 17. Generate valid HTML5 id/about attributes +!!options +parsoid +!!wikitext +<ref name="a b">foo</ref> + +<references /> +!!html +<p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span> +</p> + +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-a_b-1" id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li> +</ol> +!!end + +!!test +Ref: 18. T58916: Extension attributes should be parsed as plain text +!!options +parsoid +!!wikitext +<ref name="{{echo|a}}">foo</ref> + +<references /> +!!html +<p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span> +</p> + +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li> +</ol> +!!end + +!!test +Ref: 19. ref-tags with identical name encodings should get identical indexes +!!options +parsoid +!! wikitext +1 <ref name="a & b">foo</ref> 2 <ref name="a & b" /> + +<references /> +!! html +<p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a & b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> +</p> +<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_.26_b_1-0">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li> +</ol> +!!end -<ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'> -<li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol> +!!test +Ref: 20. ref-tags with identical names but different content should keep it +!!options +parsoid +!! wikitext +A <ref name="foo">Foo one</ref> +B <ref name="foo">Foo two</ref> +C <ref name="foo" /> + +<references /> +!! html +<p>A <span about="#mwt2" class="reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span> +C <span about="#mwt6" class="reference" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1">[1]</a></span></p> + +<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-foo_1-0">1.0</a> <a href="#cite_ref-foo_1-1">1.1</a> <a href="#cite_ref-foo_1-2">1.2</a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li> +</ol> !!end !!test @@ -19168,7 +20528,7 @@ parsoid !! wikitext <references /> !! html -<ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol> +<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol> !!end !!test @@ -19178,13 +20538,24 @@ parsoid !! wikitext A <ref group="a">foo</ref> B <ref group="b">bar</ref> +C <ref>baz</ref> <references group="a" /> +<references /> +<references group="b" /> !! html -<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-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span> +C <span class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[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 class="references" typeof="mw:Extension/references" about="#mwt8" 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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> +</ol> +<ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li> +</ol> +<ol class="references" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li> </ol> !!end @@ -19201,14 +20572,15 @@ B <ref>bar</ref> <references /> !! html -<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> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><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 class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> </ol> -<p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p> +<p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p> -<ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li> +<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li> </ol> !!end @@ -19226,15 +20598,15 @@ C <ref>cfoo</ref> <references /> !! html -<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-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2">[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 class="references" typeof="mw:Extension/references" about="#mwt6" 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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li> </ol> -<p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p> +<p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p> -<ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li> +<ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li> </ol> !!end @@ -19251,13 +20623,11 @@ B <ref name="b">bar</ref> This should just get lost. </references> !! html -<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" data-parsoid='{"src":"<ref name=\"a\" />"}'><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" data-parsoid='{"src":"<ref name=\"b\">bar</ref>"}'><a href="#cite_note-b-2">[2]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p> -<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"<references>\n<ref name=\"a\">foo</ref>\nThis should just get lost.\n</references>"}' 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='{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}' 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" data-parsoid="{}"><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" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li> +<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\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[59,82,14,6]}' data-mw='{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}'><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> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></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> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li> </ol> !!end @@ -19268,7 +20638,8 @@ parsoid !! wikitext <ref>Foo</ref> {{echo|<references />}} !! html -<span about="#mwt3" 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> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'><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><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li> +</ol> !!end !! test @@ -19285,22 +20656,81 @@ B <ref group="X" name="b" /> <ref name="b">foo</ref> </references> !! html -<p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>foo bar for a</ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span> -B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p> +<p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> +B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span> +</p> -<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"<references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol> +<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">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li> +</ol> -<ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"<references group=\"X\">\n<ref name=\"b\">foo</ref>\n</references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw='{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}' rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-2\">[X 1]</a></span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</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\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[96,119,14,6]}' data-mw='{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}'><a href=\"#cite_note-b-2\">[X 1]</a></span>\n"},"attrs":{"group":"X"}}'> +<li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li> +</ol> !! end !! test +References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template +!! options +parsoid +!! wikitext +X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}} +<references /> +!! html +<p>X<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>"}},"i":0}}]}'><a href="#cite_note-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li> +</ol> +!!end + +# This test only works in wt2html now as the <references /> are always generated +# unless selser is active. Once T72722 is fixed, we should add a changes test +# here to ensure that unrelated changes don't add the new <references /> in +# wt2wt. +!! test +References: 9. Generate missing references list at the end +!! options +parsoid +!! wikitext +A <ref>foo</ref> +B <ref group="inexistent">bar</ref> +!! html +<p>A <span class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B <span class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2">[inexistent 1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li> +</ol> +<ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'> +<li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li> +</ol> +!! end + +!! test +References: 10. New <references/> shouldn't be added for unrelated edits. +!! options +parsoid={ + "modes": ["selser"], + "changes": [["#x", "remove"]], + "selser": "noauto" +} +!! wikitext +Unrelated text<span id="x"> that's going to disappear</span>. +A <ref>foo</ref> +!! wikitext/edited +Unrelated text. +A <ref>foo</ref> +!!end + +!! test Entities in ref name !! options parsoid !! wikitext <ref name="test & me">hi</ref> +<references /> !! html -<p data-parsoid='{}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test & me"}}' id="cite_ref-test & me-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref name=\"test &amp; me\">hi</ref>"}'><a href="#cite_note-test & me-1" data-parsoid="{}">[1]</a></span></p> +<p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li> +</ol> !! end # This test is wt2html only because we're permitting the serializer to produce @@ -19314,11 +20744,9 @@ a<ref>foo</ref> <references> !! html -<p data-parsoid='{}'>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" data-parsoid='{"src":"<ref>foo</ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p> - - -<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"<references>"}' data-mw='{"name":"references","attrs":{}}'> -<li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol> +<p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol> !! end !! test @@ -19333,6 +20761,85 @@ foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw !! end #### ---------------------------------------------------------------- +#### Parsoid-only testing of Parsoid's impl of LST +#### Not implemented yet, see +#### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST +#### ---------------------------------------------------------------- + +!!test +LST Sections: 1. Simple section start and end +!! wikitext +<section begin="2011-05-16" /> +<section end="2014-04-10 (MW 1.23wmf22)" /> +!! html/parsoid +<p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/> +<meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p> +!! end + +#--------- Test stripping of empty nodes in template content ---------- +!!test +Empty LI and TR nodes should be stripped from template content +!!wikitext +{{EmptyLITest}} +{{EmptyTRTest}} +!!html/parsoid +<ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'> +<li>a</li> +<li>b</li> +</ul> +<table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'> +<tbody> +<tr> +<td>foo</td> +</tr> +<tr> +<td>bar</td> +</tr> +</tbody> +</table> +!!end + +!!test +Empty LI and TR nodes should not be stripped from top-level content +!!wikitext +* a +* +* b +{| +|- +|- +|foo +|} +!!html/parsoid +<ul> +<li> a</li> +<li></li> +<li> b</li> +</ul> +<table> +<tbody> +<tr></tr> +<tr> +<td>foo</td> +</tr> +</tbody> +</table> +!!end + +!!test +Empty TR nodes should not be stripped if they have any attributes set +!!wikitext +{{EmptyTRWithHTMLAttrTest}} +!!html/parsoid +<table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'> +<tr align="center"></tr> +<tr><td>foo</td></tr> +<tr align="center"></tr> +<tr><td>bar</td></tr> +</table> +!!end + +#### ---------------------------------------------------------------- #### The following section of tests are primarily to test #### wikitext escaping capabilities of Parsoid. Given that #### escaping can be done any number of ways, the wikitext (input) @@ -19376,11 +20883,22 @@ parsoid <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p> !!end +# New headings and existing headings are handled differently !! test Headings: 1. Nested inside html -(New headings and existing headings are handled differently) !! options parsoid=html2wt +!! html +<h1>=foo=</h1> +<h2>=foo=</h2> +<h3>=foo=</h3> + +<h1 data-parsoid=''>=foo=</h1> +<h2 data-parsoid=''>=foo=</h2> +<h3 data-parsoid=''>=foo=</h3> +<h4 data-parsoid=''>=foo=</h4> +<h5 data-parsoid=''>=foo=</h5> +<h6 data-parsoid=''>=foo=</h6> !! wikitext = =foo= = @@ -19395,23 +20913,16 @@ parsoid=html2wt =====<nowiki>=foo=</nowiki>===== ======<nowiki>=foo=</nowiki>====== -!! html -<h1>=foo=</h1> -<h2>=foo=</h2> -<h3>=foo=</h3> - -<h1 data-parsoid='{}'>=foo=</h1> -<h2 data-parsoid='{}'>=foo=</h2> -<h3 data-parsoid='{}'>=foo=</h3> -<h4 data-parsoid='{}'>=foo=</h4> -<h5 data-parsoid='{}'>=foo=</h5> -<h6 data-parsoid='{}'>=foo=</h6> !!end !! test Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar !! options parsoid=html2wt +!! html +<h1>foo</h1>*bar +<h1>foo</h1>=bar +<h1>foo</h1>=bar= !! wikitext = foo = <nowiki>*</nowiki>bar @@ -19421,26 +20932,20 @@ parsoid=html2wt = foo = <nowiki>=bar=</nowiki> -!! html -<h1>foo</h1>*bar -<h1>foo</h1>=bar -<h1>foo</h1>=bar= !!end !! test Headings: 3. Nested inside html with wikitext split by html tags !! options -parsoid=html2wt +parsoid=html2wt,wt2wt !! wikitext = ='''bold'''<nowiki>foo=</nowiki> = -!! html -<h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1> +!! html/parsoid +<h1>=<b>bold</b>foo=</h1> !!end !! test Headings: 4a. No escaping needed (testing just h1 and h2) -!! options -parsoid=html2wt !! wikitext = =foo = @@ -19454,33 +20959,33 @@ parsoid=html2wt == foo= == -= ''=''foo= = += = = -= <nowiki>=</nowiki> = -!! html += ''=''foo= = +!! html/parsoid <h1>=foo</h1> <h1>foo=</h1> <h1> =foo= </h1> <h1>=foo= bar</h1> <h2>=foo</h2> <h2>foo=</h2> +<h1>=</h1> <h1><i>=</i>foo=</h1> -<h1><span typeof="mw:Nowiki">=</span></h1> !!end !! test Headings: 4b. No escaping needed (inside p-tags) !! options parsoid=html2wt -!! wikitext -=== -=foo= x -=foo= <s></s> !! html <p>=== =foo= x =foo= <s></s> </p> +!! wikitext +=== +=foo= x +=foo= <s></s> !!end !! test @@ -19584,12 +21089,30 @@ parsoid Headings: 6d. Heading chars in SOL context (No escaping needed) !! options parsoid=html2wt -!! wikitext -=a=<div>b</div> !! html =a=<div>b</div> +!! wikitext +=a=<div>b</div> !!end +!! test +Headings: 7. Insert a newline between new content and headings +!! options +parsoid=html2wt +!! html +<h2>NEW</h2> +<p>new</p> +<h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2> +<p data-parsoid='{"dsr":[6,7,0,0]}'>a</p> +!! wikitext +== NEW == +new + +==A== +a + +!! end + #### --------------- Lists --------------- #### 0. Outside nests (*foo, etc.) #### 1. Nested inside html <ul><li>*foo</li></ul> @@ -19714,33 +21237,36 @@ Lists: 5. No unnecessary escapes !! wikitext * bar <span><nowiki>[[foo]]</nowiki></span> -*=bar <span><nowiki>[[foo]]</nowiki></span> +* =bar <span><nowiki>[[foo]]</nowiki></span> -*[[bar <span><nowiki>[[foo]]</nowiki></span> +* [[bar <span><nowiki>[[foo]]</nowiki></span> -*]]bar <span><nowiki>[[foo]]</nowiki></span> +* ]]bar <span><nowiki>[[foo]]</nowiki></span> -*=bar <span>foo]]</span>= +* =bar <span>foo]]</span>= * <s></s>: a + +* ''* foo'' !! html <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> =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> <i>* foo</i></li></ul> !!end !! test Lists: 6. Escape bullets in SOL position !! options -parsoid -!! wikitext -<!--cmt--><nowiki>*foo</nowiki> +parsoid=html2wt !! html -<p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p> +<p><!--cmt-->*foo</p> +!! wikitext +<!--cmt--><nowiki>*</nowiki>foo !!end !! test @@ -19754,22 +21280,33 @@ a </p> !!end +!! test +Lists: 8. Escape colons only if not present in tags +!! options +parsoid=html2wt +!! html +<dl><dt>a:b<i>c:d</i></dt></dl> +!! wikitext +; <nowiki>a:b</nowiki>''c:d'' +!! end + #### --------------- HRs --------------- #### 1. Single line #### ----------------------------------- !! test HRs: 1. Single line -!! options -parsoid !! wikitext ----<nowiki>----</nowiki> ----=foo= ----*foo -!! html -<hr><span typeof="mw:Nowiki">----</span> -<hr>=foo= -<hr>*foo +!! html+tidy +<hr /> +<p>----</p> +<hr /> +<p>=foo=</p> +<hr /> +<p>*foo</p> !! end #### --------------- Tables --------------- @@ -19833,127 +21370,196 @@ Tables: 1d. No escaping needed Tables: 2a. Nested in td !! options parsoid=html2wt +!! html/parsoid +<table><tbody><tr> +<td>foo|bar</td></tr> +<tr><td>x<div>a|b</div></td> +</tbody></table> !! wikitext {| |<nowiki>foo|bar</nowiki> |- |x<div><nowiki>a|b</nowiki></div> |} -!! html -<table><tbody><tr> -<td>foo|bar</td></tr> -<tr><td>x<div>a|b</div></td> -</tbody></table> +!! html/php+tidy +<table> +<tr> +<td>foo|bar</td> +</tr> +<tr> +<td>x +<div>a|b</div> +</td> +</tr> +</table> !! end !! test Tables: 2b. Nested in td !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody><tr> +<td>foo||bar</td> +<td>a<i>b||c</i></td> +<td>a<i><div>b||c</div></i></td> +</tr></tbody></table> !! wikitext {| |<nowiki>foo||bar</nowiki> -|''it''<nowiki>foo||bar</nowiki> +|a''<nowiki>b||c</nowiki>'' +|a''<div><nowiki>b||c</nowiki></div>'' |} -!! html -<table><tbody><tr> -<td><span typeof="mw:Nowiki">foo||bar</span></td> -<td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table> +!! html/php +<table> +<tr> +<td>foo||bar +</td> +<td>a<i>b||c</i> +</td> +<td>a<i><div>b||c</div></i> +</td></tr></table> + !! end !! test Tables: 2c. Nested in td -- no escaping needed -!! options -parsoid !! wikitext {| + |foo!!bar |} -!! html -<table><tbody><tr><td>foo!!bar -</td></tr></tbody></table> +!! html/* +<table> + +<tr> +<td>foo!!bar +</td></tr></table> !! end !! test Tables: 3a. Nested in th -!! options -parsoid !! wikitext {| + !foo!bar |} -!! html -<table><tbody><tr><th>foo!bar -</th></tr></tbody></table> +!! html/* +<table> + +<tr> +<th>foo!bar +</th></tr></table> !! end !! test Tables: 3b. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody> +<tr><th>foo!!bar</th> +<th><i>foo|bar</i></th> +<th><i>foo!!bar</i></th> +<th><i><span>foo!!bar</span></i></th> +</tr></tbody></table> !! wikitext {| !<nowiki>foo!!bar</nowiki> +!''<nowiki>foo|bar</nowiki>'' +!''<nowiki>foo!!bar</nowiki>'' +!''<span><nowiki>foo!!bar</nowiki></span>'' |} -!! html +!! html/php <table> -<tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr> -</tbody></table> +<tr> +<th>foo!!bar +</th> +<th><i>foo|bar</i> +</th> +<th><i>foo!!bar</i> +</th> +<th><i><span>foo!!bar</span></i> +</th></tr></table> + !! end !! test -Tables: 3c. Nested in th -- no escaping needed +Tables: 3c. Nested in th !! options -parsoid +parsoid=html2wt +!! html/parsoid +<table><tbody> +<tr><th>foo||bar</th> +<th><span typeof="mw:Nowiki">foo||bar</span></th> +</tr></tbody></table> !! wikitext {| !<nowiki>foo||bar</nowiki> +!<nowiki>foo||bar</nowiki> |} -!! html -<table><tbody><tr> -<th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table> +!! html/php +<table> +<tr> +<th>foo||bar +</th> +<th>foo||bar +</th></tr></table> + !! end !! test Tables: 4a. Escape - !! options -parsoid +parsoid=html2wt +!! html/* +<table> + +<tr> +<th>-bar +</th></tr> +<tr> +<td>-bar +</td></tr></table> + !! wikitext {| + !-bar + |- |<nowiki>-bar</nowiki> |} -!! html -<table><tbody> -<tr><th>-bar</th></tr> -<tr> -<td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table> !! end !! test Tables: 4b. Escape + !! options -parsoid +parsoid=html2wt +!! html/* +<table> + +<tr> +<th>+bar +</th></tr> +<tr> +<td>+bar +</td></tr></table> + !! wikitext {| + !+bar + |- |<nowiki>+bar</nowiki> |} -!! html -<table><tbody> -<tr><th>+bar</th></tr> -<tr> -<td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table> !! end !! test Tables: 4c. No escaping needed -!! options -parsoid !! wikitext {| |foo-bar @@ -19970,7 +21576,31 @@ bar|baz |x <div>a|b</div> |} -!! html +!! html/php +<table> +<tr> +<td>foo-bar +</td> +<td>foo+bar +</td></tr> +<tr> +<td><i>foo</i>-bar +</td> +<td><i>foo</i>+bar +</td></tr> +<tr> +<td>foo +<p>bar|baz ++bar +-bar +</p> +</td></tr> +<tr> +<td>x +<div>a|b</div> +</td></tr></table> + +!! html/parsoid <table><tbody> <tr><td>foo-bar</td><td>foo+bar</td></tr> <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr> @@ -19985,15 +21615,23 @@ bar|baz !! test Tables: 4d. No escaping needed -!! options -parsoid !! wikitext {| |[[Foo]]-bar ||+1 ||-2 |} -!! html +!! html/php +<table> +<tr> +<td><a href="/wiki/Foo" title="Foo">Foo</a>-bar +</td> +<td>+1 +</td> +<td>-2 +</td></tr></table> + +!! html/parsoid <table> <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td> <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td> @@ -20026,23 +21664,39 @@ parsoid=wt2html #### 5. Extlinks: No escapes needed #### -------------------------------------- !! test -Links 1. Quote marks in link text -!! options -parsoid +Links 1. WikiLinks: No escapes needed !! wikitext -[[Foo|Foo<nowiki>''boo''</nowiki>]] -!! html -<a rel="mw:WikiLink" href="Foo">Foo''boo''</a> +[[Foo|Foo''boo'']] +[[Foo|[Foobar]]] +[[Foo|x [Foobar] x]] +!! html/php +<p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a> +<a href="/wiki/Foo" title="Foo">[Foobar]</a> +<a href="/wiki/Foo" title="Foo">x [Foobar] x</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a> +<a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a> +<a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p> !! end !! test Links 2. WikiLinks: Escapes needed !! options -parsoid +parsoid=html2wt +!! html/parsoid +<a href="Foo" rel="mw:WikiLink">Foobar]</a> +<a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a> +<a href="Foo" rel="mw:WikiLink">[[Bar]]</a> +<a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a> +<a href="Foo" rel="mw:WikiLink">|Bar</a> +<a href="Foo" rel="mw:WikiLink">]]bar</a> +<a href="Foo" rel="mw:WikiLink">[[bar</a> +<a href="Foo" rel="mw:WikiLink">x [[ y</a> +<a href="Foo" rel="mw:WikiLink">x ]] y</a> +<a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a> !! wikitext -[[Foo|[Foobar]]] [[Foo|<nowiki>Foobar]</nowiki>]] -[[Foo|x [Foobar] x]] [[Foo|x <nowiki>[http://google.com g]</nowiki> x]] [[Foo|<nowiki>[[Bar]]</nowiki>]] [[Foo|<nowiki>x [[Bar]] x</nowiki>]] @@ -20052,37 +21706,43 @@ parsoid [[Foo|<nowiki>x [[ y</nowiki>]] [[Foo|<nowiki>x ]] y</nowiki>]] [[Foo|<nowiki>x ]] y [[ z</nowiki>]] -!! html -<a href="Foo" rel="mw:WikiLink">[Foobar]</a> -<a href="Foo" rel="mw:WikiLink">Foobar]</a> -<a href="Foo" rel="mw:WikiLink">x [Foobar] x</a> -<a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a> -<a href="Foo" rel="mw:WikiLink">[[Bar]]</a> -<a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a> -<a href="Foo" rel="mw:WikiLink">|Bar</a> -<a href="Foo" rel="mw:WikiLink">]]bar</a> -<a href="Foo" rel="mw:WikiLink">[[bar</a> -<a href="Foo" rel="mw:WikiLink">x [[ y</a> -<a href="Foo" rel="mw:WikiLink">x ]] y</a> -<a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a> +!! html/php +<p><a href="/wiki/Foo" title="Foo">Foobar]</a> +<a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a> +<a href="/wiki/Foo" title="Foo">[[Bar]]</a> +<a href="/wiki/Foo" title="Foo">x [[Bar]] x</a> +<a href="/wiki/Foo" title="Foo">|Bar</a> +<a href="/wiki/Foo" title="Foo">]]bar</a> +<a href="/wiki/Foo" title="Foo">[[bar</a> +<a href="/wiki/Foo" title="Foo">x [[ y</a> +<a href="/wiki/Foo" title="Foo">x ]] y</a> +<a href="/wiki/Foo" title="Foo">x ]] y [[ z</a> +</p> !! end !! test Links 3. WikiLinks: No escapes needed -!! options -parsoid !! wikitext [[Foo|[Foobar]] [[Foo|foo|bar]] -!! html -<a href="Foo" rel="mw:WikiLink">[Foobar</a> -<a href="Foo" rel="mw:WikiLink">foo|bar</a> +!! html/php +<p><a href="/wiki/Foo" title="Foo">[Foobar</a> +<a href="/wiki/Foo" title="Foo">foo|bar</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="Foo">[Foobar</a> +<a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p> !! end !! test Links 4. ExtLinks: Escapes needed !! options -parsoid +parsoid=html2wt +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://google.com">[google]</a> +<a rel="mw:ExtLink" href="http://google.com">google]</a></p> +<p>[http://google.com]</p> +<p>[http://google.com google]</p> !! wikitext [http://google.com <nowiki>[google]</nowiki>] [http://google.com <nowiki>google]</nowiki>] @@ -20091,21 +21751,23 @@ parsoid <nowiki>[http://google.com google]</nowiki> -!! html -<p><a href="http://google.com" rel="mw:ExtLink">[google]</a> -<a href="http://google.com" rel="mw:ExtLink">google]</a></p> -<p>[http://google.com]</p> -<p>[http://google.com google]</p> +!! html/php +<p><a rel="nofollow" class="external text" href="http://google.com">[google]</a> +<a rel="nofollow" class="external text" href="http://google.com">google]</a> +</p><p>[http://google.com] +</p><p>[http://google.com google] +</p> !! end !! test Links 5. ExtLinks: No escapes needed -!! options -parsoid !! wikitext [http://google.com [google] -!! html -<a href="http://google.com" rel="mw:ExtLink">[google</a> +!! html/php +<p><a rel="nofollow" class="external text" href="http://google.com">[google</a> +</p> +!! html/parsoid +<p><a rel="mw:ExtLink" href="http://google.com">[google</a></p> !! end !! test @@ -20162,61 +21824,90 @@ y (http://example.com) foo http://example.com, http://example.com, foo +!! html/php +<p>x +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> +y +"<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>" +(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) +(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, +<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo +</p> !! end -## Parsoid currently fails wt2html on this one! !! test Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300) !! html/parsoid -<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p> +<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\ +-<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p> !! wikitext -http://example.com.,;:!? +http://example.com.,;:!?\ +-http://example.com: +!! html/php +<p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\ +-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>: +</p> !! end !! test Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300) !! html/parsoid -<p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p> +<p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4 +<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y +X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p> !! wikitext RFC 123<nowiki/>4 +RFC 123<nowiki/>y +X<nowiki/>RFC 123<nowiki/>y !! end !! test Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300) !! html/parsoid -<p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y -X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo +<p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&foo +-<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>- </p> !! wikitext -xRFC 123y -XRFC 123y RFC 123?foo RFC 123&foo +-RFC 123- +!! html/php +<p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo +<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&foo +-<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>- +</p> !! end !! test Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300) !! html/parsoid <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4 +<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y +X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y !! wikitext PMID 123<nowiki/>4 +PMID 123<nowiki/>y +X<nowiki/>PMID 123<nowiki/>y !! end !! test Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300) !! html/parsoid -<p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y -X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo +<p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo +-<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>- </p> !! wikitext -xPMID 123y -XPMID 123y PMID 123?foo PMID 123&foo +-PMID 123- +!! html/php +<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo +<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&foo +-<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>- +</p> !! end !! test @@ -20224,20 +21915,47 @@ Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64 !! html/parsoid <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x -<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b +a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b </p> !! wikitext ISBN 1234567890<nowiki/>1 ISBN 1234567890<nowiki/>x -ISBN 1234567890<nowiki/>b +a<nowiki/>ISBN 1234567890<nowiki/>b !! end !! test -Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300) +Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300) !! html/parsoid -<p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s +<p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s +!! wikitext +-ISBN 1234567890's +!! html/php +<p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s +</p> +!! end + +!! test +Links 14. Protect link-like plain text. (Parsoid bug T78425) +!! options +parsoid=html2wt +!! html/* +<p>this is not a link: http://example.com +</p> +!! wikitext +this is not a link: <nowiki>http://example.com</nowiki> +!! end + +!! test +Links 15. Link trails can't become link prefixes. +!! options +language=is !! wikitext -ISBN 1234567890's +[[Söfnuður]]-[[00]] +!! html/php +<p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a> +</p> +!! html/parsoid +<p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p> !! end #### --------------- Quotes --------------- @@ -20247,28 +21965,31 @@ ISBN 1234567890's #### 4. No escaping needed #### -------------------------------------- !! test -1. Quotes inside <b> and <i> +1a. Quotes inside <b> and <i> !! options parsoid=html2wt,wt2wt !! wikitext -''<nowiki>'foo'</nowiki>'' +''<nowiki/>'foo''' ''<nowiki>''foo''</nowiki>'' ''<nowiki>'''foo'''</nowiki>'' ''foo''<nowiki/>'s -'''<nowiki>'foo'</nowiki>''' +'''<nowiki/>'foo'''' '''<nowiki>''foo''</nowiki>''' '''<nowiki>'''foo'''</nowiki>''' -'''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz''' +'''foo'<nowiki/>''bar'<nowiki/>''baz''' '''foo'''<nowiki/>'s '''foo'' ''foo''<nowiki/>' -'<nowiki/>''foo''<nowiki/>' +''foo'''<nowiki/>' +'''foo''<nowiki/>' ''''foo''' '''foo'''<nowiki/>' -'<nowiki/>'''foo'''<nowiki/>' +''''foo'''<nowiki/>' ''fools'<span> errand</span>'' ''<span>fool</span>'s errand'' -!! html +'<nowiki/>''foo'' bar '''baz'' +a|!*#-:;+-~[]{}b'''x'' +!! html/* <p><i>'foo'</i> <i>''foo''</i> <i>'''foo'''</i> @@ -20280,12 +22001,42 @@ parsoid=html2wt,wt2wt <b>foo</b>'s '<i>foo</i> <i>foo</i>' +<i>foo'</i>' '<i>foo</i>' '<b>foo</b> <b>foo</b>' -'<b>foo</b>'</p> +'<b>foo</b>' <i>fools'<span> errand</span></i> <i><span>fool</span>'s errand</i> +'<i>foo</i> bar '<i>baz</i> +a|!*#-:;+-~[]{}b'<i>x</i> +</p> +!! end + +!! test +1b. Quotes inside <b> and <i> with other tags on same line +!! options +parsoid=html2wt,wt2wt +!! wikitext +'''a'' foo ''[[bar]]'' +''a''' foo ''[[bar]]'' +''a''' foo '''{{echo|[[bar]]}}''' +[[foo]] x'''[[bar]]'' +'''foo'' <ref>test</ref> +'''foo'' <div title="name">test</div> +'''foo'' and <br> bar +<references /> +!! html +'<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> +<i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> +<i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b> +<a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i> +'<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> +'<i>foo</i> <div title="name">test</div> +'<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar +<ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li> +</ol> !! end !! test @@ -20300,10 +22051,10 @@ parsoid=html2wt,wt2wt </p> !! end +# FIXME: Escaping one or both of [[ and ]] is also acceptable -- +# this is one of the shortcomings of this format !! test 3. Link fragments inside <i> and <b> -(FIXME: Escaping one or both of [[ and ]] is also acceptable -- - this is one of the shortcomings of this format) !! wikitext ''[[foo''<nowiki>]]</nowiki> @@ -20319,9 +22070,11 @@ parsoid=html2wt,wt2wt !! wikitext '<span>''bar''</span>' '<span>'''bar'''</span>' +'a:b'foo !! html <p>'<span><i>bar</i></span>' '<span><b>bar</b></span>' +'a:b'foo </p> !! end @@ -20397,8 +22150,13 @@ parsoid !! wikitext foo <ref>''a'' b</ref> +<references /> !! html -<p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"<i data-parsoid='{\"dsr\":[9,14,2,2]}'>a</i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p> +<p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> +<ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'> +<li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i> + b</span></li> +</ol> !! end !! test @@ -20426,9 +22184,8 @@ parsoid parsoid !! wikitext [[File:Foobar.jpg|thumb|caption]] -!! html !! html/parsoid - <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure> + <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> !! end !! test @@ -20446,22 +22203,22 @@ parsoid=html2wt 1. Valid behavior switches should be escaped !! options parsoid=html2wt -!! wikitext -<nowiki>__TOC__</nowiki> -''<nowiki>__TOC__</nowiki>'' !! html __TOC__ <i>__TOC__</i> +!! wikitext +<nowiki>__TOC__</nowiki> +''<nowiki>__TOC__</nowiki>'' !! end !! test 2. Invalid behavior switches should not be escaped !! options parsoid=html2wt -!! wikitext +!! html __TOO__ __|__ -!! html +!! wikitext __TOO__ __|__ !! end @@ -20485,12 +22242,14 @@ parsoid !! test 2. other tags !! wikitext -<nowiki><div>foo</div> -<div style="color:red">foo</div></nowiki> +* <nowiki><div>foo</div></nowiki> +* <nowiki><div style="color:red">foo</div></nowiki> +* <nowiki><td></nowiki> !! html -<p><div>foo</div> -<div style="color:red">foo</div> -</p> +<ul><li> <div>foo</div></li> +<li> <div style="color:red">foo</div></li> +<li> <td></li></ul> + !! end !! test @@ -20570,18 +22329,6 @@ a>b </p> !! end - -# This was a bug in the PHP parser (see bug 17663 and its dups, -# https://bugzilla.wikimedia.org/show_bug.cgi?id=17663) -!! test -Tag names followed by punctuation should not be recognized as tags -!! wikitext -<s.ome> text -!! html -<p><s.ome> text -</p> -!! end - !! test HTML tag with necessary entities in attributes !! wikitext @@ -20650,7 +22397,7 @@ Table with broken attribute value quoting on consecutive lines | title="Hello world|Foo | style="color:red|Bar |} -!! html +!! html/php <table> <tr> <td>Foo @@ -20658,18 +22405,7 @@ Table with broken attribute value quoting on consecutive lines <td>Bar </td></tr></table> -!! end - -!! test -Parsoid-only: Table with broken attribute value quoting on consecutive lines -!! options -parsoid -!! wikitext -{| -| title="Hello world|Foo -| style="color:red|Bar -|} -!! html +!! html/parsoid <table><tbody> <tr> <td title="Hello world">Foo @@ -20783,9 +22519,9 @@ RT-ed inter-element separators should be valid separators !!end +# Parsoid-only since PHP parser relies on Tidy for correct output !!test Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out -(Parsoid-only since PHP parser relies on Tidy for correct output) !!options parsoid !! wikitext @@ -20798,6 +22534,14 @@ bar |<small>foo<small> |} !! html +<table> +<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo +<p>bar</p></small></td></tr> +</tbody></table> + +<table> +<tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr> +</tbody></table> !!end !!test @@ -20838,6 +22582,29 @@ Indented table with an empty td !!end +## We have some newline diffs RT-ing this edge case +## and it is not important enough -- we seem to be emitting +## at most 2 newlines after a </tr> and this is unrelated to +## the issue from T85627 that this is testing. +!!test +Indented table with blank lines in between (T85627) +!! options +parsoid=wt2html +!! wikitext + {| + |foo + + + |} +!! html +<table> + +<tr> +<td>foo +</td></tr></table> + +!!end + !!test Indented block & table !! wikitext @@ -20874,15 +22641,15 @@ Indent and comment before table row </td></tr></table> !! html/parsoid -<table data-parsoid='{}'> - <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'> +<table> + <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'> <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr> </tbody></table> !! end +# Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext !!test Empty TR followed by a template-generated TR -(Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext) !!options parsoid !! wikitext @@ -20925,32 +22692,29 @@ parsoid !!test Multi-line image caption generated by templates with/without trailing newlines -!!options -parsoid !! wikitext -[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] -[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] -!! html -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div> -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div> - +[[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] +[[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] +!! html/parsoid +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure> !!end !! test New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly !! options parsoid=html2wt +!! html +<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>foo</includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p> + +<link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1> !! wikitext <includeonly>foo</includeonly> new para -[[./Category:Foo]] +[[Category:Foo]] = new heading = -!! html -<meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>foo</includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p> - -<link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1> !! end ## PHP emits broken html for this, and since this is primarily @@ -20993,20 +22757,20 @@ plain text !!end !!test -1. Ensure fostered text content is wrapped in spans +1. Ensure fostered text content is wrapped in element nodes !!options parsoid=wt2html !! wikitext <table>hi</table><table>ho</table> !! html -<span>hi</span> +<p>hi</p> <table></table> -<span>ho</span> +<p>ho</p> <table></table> !!end !!test -2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost) +2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost) !!options parsoid=wt2html,wt2wt !! wikitext @@ -21015,11 +22779,9 @@ parsoid=wt2html,wt2wt <td> a </table> !! html -<span> || ||</span> -<table> -<tbody> -<tr> -<td> a</td></tr> +<p> || || +</p><table> +<tbody><tr><td> a</td></tr> </tbody></table> !!end @@ -21030,14 +22792,7 @@ parsoid=wt2html,wt2wt !! wikitext {{echo|<table>foo<tr><td>bar</td></tr></table>}} !! html -<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" -<table>foo -<tr> -<td>bar</td></tr></table>"}},"i":0}}]}">foo</span> -<table> -<tbody> -<tr> -<td>bar</td></tr></tbody></table> +<span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<table>foo<tr><td>bar</td></tr></table>"}},"i":0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table> !!end !!test @@ -21047,14 +22802,13 @@ parsoid=wt2wt,wt2html !! wikitext <table>{{echo|foo<tr><td>bar</td></tr>}}</table> !! html -<span typeof="mw:Transclusion" data-mw="{"parts":[" -<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo -<tr> -<td>bar</td></tr>"}},"i":0}},"</table>"]}">foo</span> -<table> +<p typeof="mw:Transclusion" data-mw="{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<tr><td>bar</td></tr>"}},"i":0}},"</table>"]}">foo</p><table> <tbody> <tr> -<td>bar</td></tr></tbody></table> +<td>bar</td> +</tr> +</tbody> +</table> !!end !!test @@ -21064,15 +22818,14 @@ parsoid=wt2wt,wt2html !! wikitext <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table> !! html -<div typeof="mw:Transclusion" data-mw="{"parts":[" -<table> -<div>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}},"</div> -<tr> -<td>bar</td></tr></table>"]}">foo</div> +<div typeof="mw:Transclusion" data-mw="{"parts":["<table><div>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}},"</div><tr><td>bar</td></tr></table>"]}">foo</div> <table> <tbody> <tr> -<td>bar</td></tr></tbody></table> +<td>bar</td> +</tr> +</tbody> +</table> !!end !!test @@ -21082,17 +22835,16 @@ parsoid=wt2wt,wt2html !! wikitext <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table> !! html -<div typeof="mw:Transclusion" data-mw="{"parts":[" -<table> -<div> -<p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div> -<tr> -<td>"}},"i":0}},"bar</td></tr></table>"]}"> -<p>foo</p></div> +<div typeof="mw:Transclusion" data-mw="{"parts":["<table><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div><tr><td>"}},"i":0}},"bar</td></tr></table>"]}"> +<p>foo</p> +</div> <table> <tbody> <tr> -<td>bar</td></tr></tbody></table> +<td>bar</td> +</tr> +</tbody> +</table> !!end !!test @@ -21102,17 +22854,16 @@ parsoid=wt2wt,wt2html !! wikitext <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table> !! html -<div typeof="mw:Transclusion" data-mw="{"parts":[" -<table> -<div> -<p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div> -<tr> -<td>"}},"i":0}},"bar</td></tr></table>"]}"> -<p>foo</p></div> +<div typeof="mw:Transclusion" data-mw="{"parts":["<table><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div><tr><td>"}},"i":0}},"bar</td></tr></table>"]}"> +<p>foo</p> +</div> <table> <tbody> <tr> -<td>bar</td></tr></tbody></table> +<td>bar</td> +</tr> +</tbody> +</table> !!end !!test @@ -21122,18 +22873,18 @@ parsoid=wt2wt,wt2html !! wikitext <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table> !! html -<span typeof="mw:Transclusion" data-mw="{"parts":[" -<table> -<tr> -<td> -<div> -<p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo"}},"i":0}},"</tr></table>"]}">foo</span> +<p typeof="mw:Transclusion" data-mw="{"parts":["<table><tr><td><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo"}},"i":0}},"</tr></table>"]}">foo</p> <table> <tbody> <tr> <td> <div> -<p>foo</p></div></td></tr></tbody></table> +<p>foo</p> +</div> +</td> +</tr> +</tbody> +</table> !!end !!test @@ -21143,18 +22894,18 @@ parsoid=wt2wt,wt2html !! wikitext <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p> !! html -<span typeof="mw:Transclusion" data-mw="{"parts":[" -<table> -<tr> -<td> -<div> -<p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo</tr></table>"}},"i":0}}]}">foo</span> +<p typeof="mw:Transclusion" data-mw="{"parts":["<table><tr><td><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo</tr></table>"}},"i":0}}]}">foo</p> <table> <tbody> <tr> <td> <div> -<p>foo</p></div></td></tr></tbody></table> +<p>foo</p> +</div> +</td> +</tr> +</tbody> +</table> <p>ok</p> !!end @@ -21165,14 +22916,14 @@ parsoid=wt2wt,wt2html !! wikitext <table>{{echo|<p>foo</p>}}<td>bar</td></table> !! html -<p typeof="mw:Transclusion" data-mw="{"parts":[" -<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" -<p>foo</p>"}},"i":0}}," -<td>bar</td></table>"]}">foo</p> +<p typeof="mw:Transclusion" data-mw="{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<p>foo</p>"}},"i":0}},"<td>bar</td></table>"]}">foo</p> <table> <tbody> <tr> -<td>bar</td></tr></tbody></table> +<td>bar</td> +</tr> +</tbody> +</table> !!end !!test @@ -21186,11 +22937,13 @@ parsoid=wt2wt,wt2html |b |} !! html -<p typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}">a</p><span typeof="mw:Transclusion" data-mw="{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"'color:red'"}},"i":0}},"\n|-\n|b\n|}"]}">{{{1}}}</span> -<table> +<p typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"'color:red'"}},"i":0}},"\n|-\n|b\n|}"]}">{{{1}}}</p><table> <tbody> <tr> -<td>b</td></tr></tbody></table> +<td>b</td> +</tr> +</tbody> +</table> !!end !!test @@ -21200,8 +22953,7 @@ parsoid=wt2wt,wt2html !! wikitext <table>{{echo|hi</table>hello}} !! html -<span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi</table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</span> -<table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span> +<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi</table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p> !!end !!test @@ -21216,7 +22968,7 @@ parsoid=wt2html,wt2wt </div> |} !! html -<div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n<div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1" data-parsoid="{}"> +<div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n<div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1"> </span> <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table> @@ -21234,7 +22986,7 @@ Properly encapsulate empty-content transclusions in fosterable positions }} </table> !! html/parsoid -<table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n<td>foo</td>\n"}},"i":0}},"\n</table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]],"src":"<table>\n{{#if:|\n<td>foo</td>\n}}\n</table>"}'> +<table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n<td>foo</td>\n"}},"i":0}},"\n</table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}'> </table> !! end @@ -21243,12 +22995,23 @@ Properly encapsulate empty-content transclusions in fosterable positions Support <object> element with .data attribute !!options parsoid=html2wt -!! wikitext -<object data="test.swf"></object> !! html <object data="test.swf"></object> +!! wikitext +<object data="test.swf"></object> !!end +!! test +Don't block XML namespace declaration +!! wikitext +<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span> +!! html/php +<p><span>MediaWiki</span> +</p> +!! html/parsoid +<p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p> +!! end + # ----------------------------------------------------------------- # The following section of tests are primarily to spec requirements # around serialization of new/edited content. @@ -21256,15 +23019,101 @@ parsoid=html2wt # All these tests are marked Parsoid html2wt and html2html only # ---------------------------------------------------------------- +# 'mi' is a localinterwiki prefix as well as a language !! test Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869) !! options parsoid=html2wt -language=es +!! html +<p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p> !! wikitext [[Foo]] +!! end + +# See T93839 +!! test +New wikilinks should be serialized properly +!! options +parsoid=html2wt !! html -<p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p> +<a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a> +<a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a> +!! wikitext +[[Foo]] +[[Foo]] +!! end + +!! test +New wiki links (href variations) +!! options +parsoid=html2wt +!! html +<a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a> +<a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a> +<a rel="mw:WikiLink" href="Foo bar">Foo_bar</a> +<a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a> +!! wikitext +[[Foo_bar]] +[[Foo_bar]] +[[Foo_bar]] +[[Toxine bactérienne]] +!! end + +!! test +New wiki links (content string variations) +!! options +parsoid=html2wt +!! html +<a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a> +<a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a> +<a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a> +!! wikitext +[[Foo_bar]] +[[Foo bar]] +[[Foo_bar|./Foo_bar]] +!! end + +!! test +New category links (href variations) +!! options +parsoid=html2wt +!! html +<link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" /> +<link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" /> +<link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" /> +!! wikitext +[[Category:Toxine bactérienne]] +[[Category:Toxine bactérienne]] +[[Category:Toxine bactérienne]] +!! end + +!! test +New sol transparent links don't need indent-pre nowiki protection +!! options +parsoid=html2wt +language=de +!! html + <link rel="mw:PageProp/redirect" href="./Main_Page"> +<!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" /> +<!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" /> +!! wikitext + #WEITERLEITUNG [[Main Page]] +<!-- this is good --> [[Category:Good]] +<!-- this is great --> [[Kategorie:Great]] +!! end + +!! test +New interlanguage links (href variations) +!! options +parsoid=html2wt +!! html +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" /> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" /> +<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" /> +!! wikitext +[[es:Toxine bactérienne]] +[[es:Toxine_bactérienne]] +[[es:Toxine_bactérienne]] !! end !! test @@ -21401,7 +23250,7 @@ parsoid !! wikitext [[File:Foobar.jpg|thumb|alt=|bar]] !! html -<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure> !! end #!! test @@ -21409,37 +23258,34 @@ parsoid #!! options #parsoid=html2wt #language=ar -#!! input +#!! html +#<figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure> +#!! wikitext #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] -#!! result -#<figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="180"/></a></figure> #!! end !! test Image: Block level image should have \n before and after -!! options -parsoid !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 -!! html -<p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p> +!! html/parsoid +<p>123</p> +<figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure> +<p>456</p> !!end !! test -Image: New block level image should have \n before and after (existing -content) -!! options -parsoid +Image: New block level image should have \n before and after (existing content) !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 -!! html -<p data-parsoid='{"dsr":[0,3,0,0]}'>123</p> -<figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure> -<p data-parsoid='{"dsr":[46,49,0,0]}'>456</p> +!! html/parsoid +<p>123</p> +<figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure> +<p>456</p> !!end !! test @@ -21451,7 +23297,9 @@ parsoid [[File:Foobar.jpg|thumb|upright=0.5|caption]] [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]] !! html -<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure><figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure> +<figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure> +<figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure> !!end !! test @@ -21461,7 +23309,7 @@ parsoid !! wikitext [[File:Foobar.jpg|500x500px|upright=0.5|caption]] !! html -<p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a></span></p> +<p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p> !!end !! test @@ -21470,7 +23318,7 @@ Image: from basic HTML (1) parsoid=html2wt !! html/parsoid <span typeof="mw:Image"> - <img src="File:Foobar.jpg" width=100 height=100 alt="Alt"> + <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"> </span> !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] @@ -21481,7 +23329,7 @@ Image: from basic HTML (2) !! options parsoid=html2wt !! html/parsoid -<img src="File:Foobar.jpg" width=100 height=100 alt="Alt"> +<img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"> !! wikitext [[File:Foobar.jpg|link=|alt=Alt|100x100px]] !! end @@ -21491,7 +23339,7 @@ Image: from basic HTML (3) !! options parsoid=html2wt !! html/parsoid -<a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a> +<a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a> !! wikitext [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]] !! end @@ -21501,7 +23349,7 @@ Image: from basic HTML (4) !! options parsoid=html2wt !! html/parsoid -<img src="File:Foobar.jpg"> +<img src="./File:Foobar.jpg"> !! wikitext [[File:Foobar.jpg|link=]] !! end @@ -21510,28 +23358,41 @@ parsoid=html2wt Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options parsoid=html2wt -!! wikitext -* foo !! html <ul> <li><p>foo</p></li> </ul> +!! wikitext +* foo !! end !! test Lists: Serialize correctly even when list tags has unneeded whitespace between tags !! options parsoid=html2wt -!! wikitext -* foo !! html <ul> <li>foo</li></ul> +!! wikitext +* foo !! end !! test Don't strip leading whitespace when handling indent-pre suppressing tags !! options parsoid=html2wt +!! html +<table> + <tr><td> indented row</td></tr> +</table> +<blockquote><p> + <b>This is very bold of you!</b> +</p> +<table><tr><td> + indented cell (no pre-wrapping!) +</td></tr></table> +</blockquote> +<p>foo</p> + <div>bar</div> !! wikitext {| | indented row @@ -21546,19 +23407,6 @@ parsoid=html2wt </blockquote> foo <div>bar</div> -!! html -<table> - <tr><td> indented row</td></tr> -</table> -<blockquote><p> - <b>This is very bold of you!</b> -</p> -<table><tr><td> - indented cell (no pre-wrapping!) -</td></tr></table> -</blockquote> -<p>foo</p> - <div>bar</div> !! end !! test @@ -21597,33 +23445,38 @@ foo Lists: Add space after bullets !! options parsoid=html2wt -!! wikitext -* foo -* bar -* <span> baz</span> !! html <ul> <li>foo</li> <li> bar</li> <li><span> baz</span></li> </ul> +!! wikitext +* foo +* bar +* <span> baz</span> !! end !! test Lists: Dont insert newlines in a serialized list item. !! options parsoid=html2wt +!! html +<ul><li>a<br>b</li><li>c</li></ul> !! wikitext * a<br>b * c -!! html -<ul><li>a<br>b</li><li>c</li></ul> !! end !! test Headings: Add space before/after == (Bug 51744) !! options parsoid=html2wt +!! html +<h2>foo</h2> +<h2> bar</h2> +<h2>baz </h2> +<h2><span> baz</span></h2> !! wikitext == foo == @@ -21632,25 +23485,32 @@ parsoid=html2wt == baz == == <span> baz</span> == -!! html -<h2>foo</h2> -<h2> bar</h2> -<h2>baz </h2> -<h2><span> baz</span></h2> !! end !! test -Parsoid: Serialize positional parameters with = in them as named parameter +Headings: Force metas to serialize before/after !! options parsoid=html2wt +!! html +<h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2> +<h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2> + +<h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2> !! wikitext -{{echo|1 = f=oo}} +== hello there == +[[Category:A1]] -{{echo|1 = f=oo|2 = bar}} +[[Category:A2]] +== hi pal == -<!--Orig params with data-parsoid has heuristics for handling = chars--> -<!--FIXME: But maybe the heuristic needs fixing to apply to new params as well--> -{{echo|<nowiki>f=oo</nowiki>|bar}} +<!--foo--> [[Category:A3]] +== how goes it == +!! end + +!! test +Parsoid: Serialize positional parameters with = in them as named parameter +!! options +parsoid=html2wt !! html <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p> @@ -21661,12 +23521,37 @@ data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"}, <!--Orig params with data-parsoid has heuristics for handling = chars--> <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well--> <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p> +!! wikitext +{{echo|1 = f=oo}} + +{{echo|1 = f=oo|2 = bar}} + +<!--Orig params with data-parsoid has heuristics for handling = chars--> +<!--FIXME: But maybe the heuristic needs fixing to apply to new params as well--> +{{echo|<nowiki>f=oo</nowiki>|bar}} +!! end + +!! test +Parsoid: Serialize positional parameters with = in extlink as named parameter +!! options +parsoid=html2wt +!! html +<p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p> +!! wikitext +{{echo|1 = http://stuff?is=ok}} !! end !! test Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes !! options parsoid=html2wt +!! html +<div>a<p>b</p></div> +<div>a +<p>b</p></div> +<div> +a +<p>b</p></div> !! wikitext <div>a b @@ -21679,23 +23564,32 @@ a b </div> -!! html -<div>a<p>b</p></div> -<div>a -<p>b</p></div> -<div> -a -<p>b</p></div> !! end !! test Substrings resembling wikitext in hrefs should not get nowiki escapes !! options parsoid=html2wt +!! html +<a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a> !! wikitext [[Foo''bar''baz]] +!! end + +!! test +Enforce single-line context in the serializer +!! options +parsoid=html2wt !! html -<a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a> +<h2>testing +123</h2> + +<ul><li>asd +sdf</li></ul> +!! wikitext +== testing 123 == + +* asd sdf !! end #----------------------------- @@ -21706,6 +23600,15 @@ parsoid=html2wt 1. I/B quote minimization: wikitext-only tags should be combined !! options parsoid=html2wt +!! html +<p><i>A</i><i>B</i></p> +<p><b>A</b><b>B</b></p> +<p><i>A</i><b><i>B</i></b></p> +<p><b>A</b><i><b>B</b></i></p> +<p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p> +<p><i><b>A</b></i><i><b>B</b></i></p> +<p><i><b>A</b></i><b><i>B</i></b></p> +<p><b><i>A</i></b><i><b>B</b></i></p> !! wikitext ''AB'' @@ -21722,57 +23625,78 @@ parsoid=html2wt '''''AB''''' '''''AB''''' -!! html -<p><i>A</i><i>B</i></p> -<p><b>A</b><b>B</b></p> -<p><i>A</i><b><i>B</i></b></p> -<p><b>A</b><i><b>B</b></i></p> -<p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p> -<p><i><b>A</b></i><i><b>B</b></i></p> -<p><i><b>A</b></i><b><i>B</i></b></p> -<p><b><i>A</i></b><i><b>B</b></i></p> !! end !! test 2. I/B quote minimization: wikitext and html tags should not be combined !! options parsoid=html2wt -!! wikitext -''A''<i>B</i> - -''A'''''<i>B</i>''' !! html <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p> <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p> +!! wikitext +''A''<i>B</i> + +''A''<nowiki/>'''<i>B</i>''' !! end !! test 3. I/B quote minimization: templated content stops minimization !! options parsoid=html2wt +!! html +<p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"''B''"}},"i":0}}]}'>B</i> +<p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"'''''B'''''"}},"i":0}}]}'><i>B</i></b> !! wikitext ''A''{{echo|''B''}} ''A''{{echo|'''''B'''''}} -!! html -<p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"''B''"}},"i":0}}]}'>B</i> -<p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"'''''B'''''"}},"i":0}}]}'><i>B</i></b> !! end !! test 4. I/B quote minimization: new content should be mimimized with adjacent old content !! options parsoid=html2wt +!! html +<p><i>A</i><i>B</i></p> +<p><b>A</b><b>B</b></p> +<p><i>A</i><b><i>B</i></b></p> !! wikitext ''AB'' '''AB''' ''A'''B''''' -!! html -<p><i>A</i><i data-parsoid='{}'>B</i></p> -<p><b data-parsoid='{}'>A</b><b>B</b></p> -<p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p> +!! end + +!! test +5a. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt", "selser"], + "changes": [ + ["p", "contents", "remove", ":contains('b')"] + ] +} +!! wikitext +''a''b''c'' +!! wikitext/edited +''ac'' +!! end + +!! test +5b. Merge adjacent quote nodes if they've been edited +!! options +parsoid={ + "modes": ["wt2wt", "selser"], + "changes": [ + ["#x", "remove"] + ] +} +!! wikitext +''a''<span id="x">b</span>''c'' +!! wikitext/edited +''ac'' !! end #------------------------------------ @@ -21796,16 +23720,6 @@ parsoid=html2wt Magic words !! options parsoid=html2wt -!! wikitext -__TOC__ -__NOTOC__ -__FORCETOC__ -__INDEX__ -__NOINDEX__ -__NOGALLERY__ -__NOEDITSECTION__ -__NOTITLECONVERT__ -__NOCONTENTCONVERT__ !! html <meta property='mw:PageProp/toc' /> <meta property='mw:PageProp/notoc' /> @@ -21817,12 +23731,34 @@ __NOCONTENTCONVERT__ <meta property='mw:PageProp/notitleconvert' /> <meta property='mw:PageProp/nocontentconvert' /> <meta property='mw:PageProp/unknownproperty' /> +!! wikitext +__TOC__ +__NOTOC__ +__FORCETOC__ +__INDEX__ +__NOINDEX__ +__NOGALLERY__ +__NOEDITSECTION__ +__NOTITLECONVERT__ +__NOCONTENTCONVERT__ !! end !! test Consecutive <pre>s should not get merged !! options parsoid=html2wt,html2html +!! html +<pre>a</pre><pre>b</pre> + +<pre>c +</pre><pre> +d</pre> + +<pre>e + +</pre><pre> + +f</pre> !! wikitext a @@ -21837,58 +23773,209 @@ parsoid=html2wt,html2html f -!! html -<pre>a</pre><pre>b</pre> - -<pre>c -</pre><pre> -d</pre> - -<pre>e - -</pre><pre> - -f</pre> !! end !! test Edited ISBN links not serializable as ISBN links should serialize as wikilinks !! options parsoid=html2wt -!! wikitext -[[Special:BookSources/1234567890|ISBN 1234567895]] !! html <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a> +!! wikitext +[[Special:BookSources/1234567890|ISBN 1234567895]] !! end !! test Edited RFC links not serializable as RFC links should serialize as extlinks !! options parsoid=html2wt -!! wikitext -[//tools.ietf.org/html/rfc123 New RFC] !! html <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a> +!! wikitext +[//tools.ietf.org/html/rfc123 New RFC] !! end !! test Edited PMID links not serializable as PMID links should serialize as extlinks !! options parsoid=html2wt -!! wikitext -[//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID] !! html <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a> +!! wikitext +[//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID] +!! end + +!! test +WTS of autolinks with trailing/surrounding context +!! options +parsoid=html2wt +!! html/parsoid +<p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p> +<p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p> +<p><b><a href="http://cscott.net">http://cscott.net</a></b></p> +<p><b><a href="http://cscott.net">http://cscott.net</a> </b></p> +<p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p> +<p><a href="http://cscott.net">http://cscott.net</a>x</p> +!! wikitext +http://cscott.net<nowiki/>'''foo''' + +http://cscott.net<b>foo</b> + +'''http://cscott.net<nowiki/>''' + +'''http://cscott.net ''' + +'''http://cscott.net<nowiki/>x''' + +http://cscott.net<nowiki/>x +!! end + +!! test +WTS of autolinks with nowikis (round-trip) +!! wikitext +x<nowiki/>http://cscott.net<nowiki/>x +!! html/parsoid +<p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p> +!! end + +# this is the "easy" test because it leaves in place all the +# data-parsoid information indicating this is an autolink +!! test +WTS of autolinks with escapes (editing) +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + [ "meta", "remove" ] + ] +} +!! wikitext +x<nowiki/>http://cscott.net<nowiki/>x +!! wikitext/edited +x<nowiki/>http://cscott.net<nowiki/>x !! end !! test Edited Redirect link should emit a non-piped wikitext link !! options parsoid=html2wt +!! html +<link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'> !! wikitext #REDIRECT [[Bar]] +!! end + +!! test +T75121: Infer extension name from typeOf if data-mw is not present +!! options +parsoid=html2wt +!! html +<div typeOf="mw:Extension/foo"></div> +!! wikitext +<foo /> +!! end + +# Note that the <p> wrapping isn't present in PHP parser output +# The important thing for this test is that P-wrapping doesn't +# interfere with the <nowiki> protection for leading - in <td> +# (which isn't necessary for <th>). +!! test +T88318: p-wrapped dash in table. +!! options +parsoid=html2wt,wt2wt +!! html/parsoid +<table><tbody> +<tr><th><p>-</p></th><th><p>- </p></th></tr> +<tr><td><p>-</p></td><td><p>- </p></td></tr> +<tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr> +</tbody></table> +!! wikitext +{| +!- +!- +|- +|<nowiki>-</nowiki> +|<nowiki>- </nowiki> +|- +|<small>-</small> +|<br> +- +|<br> +- +|} +!! html/php+tidy +<table> +<tr> +<th>-</th> +<th>-</th> +</tr> +<tr> +<td>-</td> +<td>-</td> +</tr> +<tr> +<td><small>-</small></td> +<td><br /> +<p>-</p> +</td> +<td><br /> +<p>-</p> +</td> +</tr> +</table> +!! end + +!! test +HTML id attribute with Parsoid-like element ids should not be serialized to wikitext +!! options +parsoid=html2wt +!! html +<table id='mwAb'> +<td id='mwAc'>foo</td> +<td id='serialize-this'>bar</td> +</table> +!! wikitext +{| +|foo +| id="serialize-this" |bar +|} +!! end + +!! test +Parsoid-like element ids should not be serialized to wikitext unless shadowed +!! options +parsoid=html2wt !! html -<link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'> +<div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div> +!! wikitext +<div id="hello">ok</div> +!! end + +!! test +WTS change modes +!! options +parsoid={ + "modes": ["wt2wt"], + "changes": [ + [ "#xyz", "before", "<b>before</b> stuff " ], + [ "#xyz", "after", " stuff <i>after</i>" ], + [ "#xyz", "html", "x <b>y</b> z" ] + ] +} +!! wikitext +<span id="xyz">hello</span> +!! wikitext/edited +'''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after'' +!! end + +!! test +Never serialize a-tag as html, regardless of what data-parsoid has to say +!! options +parsoid=html2wt +!! html +<a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a> +!! wikitext +[[Foo]] !! end # ----------------------------------------------------------------- @@ -21896,6 +23983,53 @@ parsoid=html2wt # of new content # ----------------------------------------------------------------- +# ----------------------------------------------------------------- +# The following section of tests are primarily to spec behavior of +# the selective serializer. All these tests have manual selser +# changes. The automated selser changes for all tests handle the +# wide variation of changes, but these tests here capture specs +# deterministically. +# ---------------------------------------------------------------- + +## T90517 +!! test +1. Selser: New comments should not be lost +!! options +parsoid={ + "modes": ["selser"], + "changes": [ + [ "#a", "after", "<!--c1-->" ], + [ "#b", "before", "<!--c2-->" ] + ] +} +!! wikitext +<span id="a">a</span> + +<span id="b">b</span> +!! wikitext/edited +<span id="a">a</span><!--c1--> + +<!--c2--><span id="b">b</span> +!! end + +## T89383 +!! test +2. Selser: Check for validity of DSR before using it +!! options +parsoid={ + "modes": ["selser"], + "changes": [ + [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ] + ] +} +!! wikitext +<span id="a">a</span> +!! wikitext/edited +{{DISPLAYTITLE:foo}} +<span id="a">a</span> +!! end + + TODO: more images more tables diff --git a/tests/parser/parserTestsParserHook.php b/tests/parser/parserTestsParserHook.php index c8b3e897..221fc79a 100644 --- a/tests/parser/parserTestsParserHook.php +++ b/tests/parser/parserTestsParserHook.php @@ -29,6 +29,7 @@ class ParserTestParserHook { static function setup( &$parser ) { $parser->setHook( 'tag', array( __CLASS__, 'dumpHook' ) ); + $parser->setHook( 'tåg', array( __CLASS__, 'dumpHook' ) ); $parser->setHook( 'statictag', array( __CLASS__, 'staticTagHook' ) ); return true; } diff --git a/tests/parser/preprocess/All_system_messages.expected b/tests/parser/preprocess/All_system_messages.expected index 078d8f0d..2ee805e0 100644 --- a/tests/parser/preprocess/All_system_messages.expected +++ b/tests/parser/preprocess/All_system_messages.expected @@ -2207,13 +2207,6 @@ Log in </td><td> <template lineStart="1"><title>int:Login</title></template> </td></tr><tr><td> -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Loginend&action=edit loginend]<br> -[[MediaWiki_talk:Loginend|Talk]] -</td><td> -&amp;nbsp; -</td><td> -<template lineStart="1"><title>int:Loginend</title></template> -</td></tr><tr><td> [http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Loginerror&action=edit loginerror]<br> [[MediaWiki_talk:Loginerror|Talk]] </td><td> diff --git a/tests/parser/preprocess/All_system_messages.txt b/tests/parser/preprocess/All_system_messages.txt index 3c30da94..4a30f56f 100644 --- a/tests/parser/preprocess/All_system_messages.txt +++ b/tests/parser/preprocess/All_system_messages.txt @@ -2207,13 +2207,6 @@ Log in </td><td> {{int:Login}} </td></tr><tr><td> -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Loginend&action=edit loginend]<br> -[[MediaWiki_talk:Loginend|Talk]] -</td><td> -&nbsp; -</td><td> -{{int:Loginend}} -</td></tr><tr><td> [http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Loginerror&action=edit loginerror]<br> [[MediaWiki_talk:Loginerror|Talk]] </td><td> |