diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /tests/parser | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'tests/parser')
-rw-r--r-- | tests/parser/parserTest.inc | 18 | ||||
-rw-r--r-- | tests/parser/parserTests.txt | 1227 |
2 files changed, 1206 insertions, 39 deletions
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 30e451b3..86e1e192 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -140,7 +140,7 @@ class ParserTest { $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, $parserMemc, $wgThumbnailScriptPath, $wgScriptPath, $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath, $wgExtensionAssetsPath, - $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType; + $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgLockManagers; $wgScript = '/index.php'; $wgScriptPath = '/'; @@ -149,6 +149,11 @@ class ParserTest { $wgStylePath = '/skins'; $wgExtensionAssetsPath = '/extensions'; $wgThumbnailScriptPath = false; + $wgLockManagers = array( array( + 'name' => 'fsLockManager', + 'class' => 'FSLockManager', + 'lockDirectory' => wfTempDir() . '/test-repo/lockdir', + ) ); $wgLocalFileRepo = array( 'class' => 'LocalRepo', 'name' => 'local', @@ -627,6 +632,11 @@ class ParserTest { 'wgScriptPath' => '/', 'wgArticlePath' => '/wiki/$1', 'wgActionPaths' => array(), + 'wgLockManagers' => array( + 'name' => 'fsLockManager', + 'class' => 'FSLockManager', + 'lockDirectory' => $this->uploadDir . '/lockdir', + ), 'wgLocalFileRepo' => array( 'class' => 'LocalRepo', 'name' => 'local', @@ -680,7 +690,6 @@ class ParserTest { 'wgExternalLinkTarget' => false, 'wgAlwaysUseTidy' => false, 'wgHtml5' => true, - 'wgCleanupPresentationalAttributes' => true, 'wgWellFormedXml' => true, 'wgAllowMicrodataAttributes' => true, 'wgAdaptiveMessageCache' => true, @@ -700,6 +709,9 @@ class ParserTest { $this->savedGlobals = array(); + /** @since 1.20 */ + wfRunHooks( 'ParserTestGlobals', array( &$settings ) ); + foreach ( $settings as $var => $val ) { if ( array_key_exists( $var, $GLOBALS ) ) { $this->savedGlobals[$var] = $GLOBALS[$var]; @@ -951,6 +963,8 @@ class ParserTest { */ private function teardownGlobals() { RepoGroup::destroySingleton(); + FileBackendGroup::destroySingleton(); + LockManagerGroup::destroySingleton(); LinkCache::singleton()->clear(); foreach ( $this->savedGlobals as $var => $val ) { diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 11a55163..df057248 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -59,6 +59,12 @@ MediaWiki:bad image list * [[File:Bad.jpg]] except [[Nasty page]] !!endarticle +!! article +Template:inner list +!! text +* item 1 +!! endarticle + ### ### Basic tests ### @@ -79,6 +85,29 @@ This is a simple paragraph. !! end !! test +Paragraphs with extra newline spacing +!! input +foo + +bar + + +baz + + + +booz +!! result +<p>foo +</p><p>bar +</p><p><br /> +baz +</p><p><br /> +</p><p>booz +</p> +!! end + +!! test Simple list !! input * Item 1 @@ -129,6 +158,285 @@ Italics and bold !! end ### +### 2-quote opening sequence tests +### +!! test +Italics and bold: 2-quote opening sequence: (2,2) +!! input +''foo'' +!! result +<p><i>foo</i> +</p> +!!end + + +!! test +Italics and bold: 2-quote opening sequence: (2,3) +!! input +''foo''' +!! result +<p><i>foo'</i> +</p> +!!end + + +!! test +Italics and bold: 2-quote opening sequence: (2,4) +!! input +''foo'''' +!! result +<p><i>foo''</i> +</p> +!!end + + +!! test +Italics and bold: 2-quote opening sequence: (2,5) +!! input +''foo''''' +!! result +<p><i>foo</i> +</p> +!!end + + +### +### 3-quote opening sequence tests +### + +!! test +Italics and bold: 3-quote opening sequence: (3,2) +!! input +'''foo'' +!! result +<p>'<i>foo</i> +</p> +!!end + + +!! test +Italics and bold: 3-quote opening sequence: (3,3) +!! input +'''foo''' +!! result +<p><b>foo</b> +</p> +!!end + + +!! test +Italics and bold: 3-quote opening sequence: (3,4) +!! input +'''foo'''' +!! result +<p><b>foo'</b> +</p> +!!end + + +!! test +Italics and bold: 3-quote opening sequence: (3,5) +!! input +'''foo''''' +!! result +<p><b>foo</b> +</p> +!!end + + +### +### 4-quote opening sequence tests +### + +!! test +Italics and bold: 4-quote opening sequence: (4,2) +!! input +''''foo'' +!! result +<p>''<i>foo</i> +</p> +!!end + + +!! test +Italics and bold: 4-quote opening sequence: (4,3) +!! input +''''foo''' +!! result +<p>'<b>foo</b> +</p> +!!end + + +!! test +Italics and bold: 4-quote opening sequence: (4,4) +!! input +''''foo'''' +!! result +<p>'<b>foo'</b> +</p> +!!end + + +!! test +Italics and bold: 4-quote opening sequence: (4,5) +!! input +''''foo''''' +!! result +<p>'<b>foo</b> +</p> +!!end + + +### +### 5-quote opening sequence tests +### + +!! test +Italics and bold: 5-quote opening sequence: (5,2) +!! input +'''''foo'' +!! result +<p><b><i>foo</i></b> +</p> +!!end + + +!! test +Italics and bold: 5-quote opening sequence: (5,3) +!! input +'''''foo''' +!! result +<p><i><b>foo</b></i> +</p> +!!end + + +!! test +Italics and bold: 5-quote opening sequence: (5,4) +!! input +'''''foo'''' +!! result +<p><i><b>foo'</b></i> +</p> +!!end + + +!! test +Italics and bold: 5-quote opening sequence: (5,5) +!! input +'''''foo''''' +!! result +<p><i><b>foo</b></i> +</p> +!!end + +### +### multiple quote sequences in a line +### +!! test +Italics and bold: multiple quote sequences: (2,4,2) +!! input +''foo''''bar'' +!! result +<p><i>foo'<b>bar</b></i> +</p> +!!end + + +!! test +Italics and bold: multiple quote sequences: (2,4,3) +!! input +''foo''''bar''' +!! result +<p><i>foo'<b>bar</b></i> +</p> +!!end + + +!! test +Italics and bold: multiple quote sequences: (2,4,4) +!! input +''foo''''bar'''' +!! result +<p><i>foo'<b>bar'</b></i> +</p> +!!end + + +!! test +Italics and bold: multiple quote sequences: (3,4,2) +!! input +'''foo''''bar'' +!! result +<p><b>foo'</b>bar +</p> +!!end + + +!! test +Italics and bold: multiple quote sequences: (3,4,3) +!! input +'''foo''''bar''' +!! result +<p><b>foo'</b>bar +</p> +!!end + +### +### other quote tests +### +!! test +Italics and bold: other quote tests: (2,3,5) +!! input +''this is about '''foo's family''''' +!! result +<p><i>this is about <b>foo's family</b></i> +</p> +!!end + + +!! test +Italics and bold: other quote tests: (2,(3,3),2) +!! input +''this is about '''foo's''' family'' +!! result +<p><i>this is about <b>foo's</b> family</i> +</p> +!!end + + +!! test +Italics and bold: other quote tests: (3,2,3,2) +!! input +'''this is about ''foo'''s family'' +!! result +<p><b>this is about <i>foo</i></b><i>s family</i> +</p> +!!end + + +!! test +Italics and bold: other quote tests: (3,2,3,3) +!! input +'''this is about ''foo'''s family''' +!! result +<p>'<i>this is about </i>foo<b>s family</b> +</p> +!!end + + + +!! test +Italics and bold: other quote tests: (3,(2,2),3) +!! input +'''this is about ''foo's'' family''' +!! result +<p><b>this is about <i>foo's</i> family</b> +</p> +!!end + +### ### <nowiki> test cases ### @@ -634,6 +942,388 @@ Definition and unordered list using wiki syntax nested in unordered list using h !! end +!! test +Definition list with empty definition and following paragraph +!! input +; term: +Paragraph text +!! result +<dl><dt> term</dt><dd> +</dd></dl> +<p>Paragraph text +</p> +!! end + +!! test +Definition Lists: No nesting: Multiple dd's +!! input +;x +:a +:b +!! result +<dl><dt>x +</dt><dd>a +</dd><dd>b +</dd></dl> + +!! end + +!! test +Definition Lists: Indentation: Regular +!! input +:i1 +::i2 +:::i3 +!! result +<dl><dd>i1 +<dl><dd>i2 +<dl><dd>i3 +</dd></dl> +</dd></dl> +</dd></dl> + +!! end + +!! test +Definition Lists: Indentation: Missing 1st level +!! input +::i2 +:::i3 +!! result +<dl><dd><dl><dd>i2 +<dl><dd>i3 +</dd></dl> +</dd></dl> +</dd></dl> + +!! end + +!! test +Definition Lists: Indentation: Multi-level indent +!! input +:::i3 +!! result +<dl><dd><dl><dd><dl><dd>i3 +</dd></dl> +</dd></dl> +</dd></dl> + +!! end + +## The PHP parser treats : items (dd) without a corresponding ; item (dt) +## as an empty dt item. It also ignores all but the last ";" when followed +## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in +## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple +## ";"s. +## +## Ex: ";;t2 ::d2" is transformed into: +## +## <dl> +## <dt>t2 </dt> +## <dd> +## <dl> +## <dt></dt> +## <dd>d2</dd> +## </dl> +## </dd> +## </dl> +## +## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text +## So, the same wikitext above (;;t2 ::d2) is transformed into: +## +## <dl> +## <dt> +## <dl> +## <dt>t2 </dt> +## <dd>:d2</dd> +## </dl> +## </dt> +## </dl> +## +## All Parsoid only definition list tests have this difference. +## +## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569 +## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html + +!! test +Definition Lists: Nesting: Multi-level (Parsoid only) +!! options +disabled +!! input +;t1 :d1 +;;t2 ::d2 +;;;t3 :::d3 +!! result +<dl> + <dt>t1 </dt> + <dd>d1</dd> + <dt> + <dl> + <dt>t2 </dt> + <dd>:d2</dd> + <dt> + <dl> + <dt>t3 </dt> + <dd>::d3</dd> + </dl> + </dt> + </dl> + </dt> +</dl> + + +!! end + + +!! test +Definition Lists: Nesting: Test 2 (Parsoid only) +!! options +disabled +!! input +;t1 +::d2 +!! result +<dl> + <dt>t1</dt> + <dd> + <dl> + <dd>d2</dd> + </dl> + </dd> +</dl> + +!! end + + +!! test +Definition Lists: Nesting: Test 3 (Parsoid only) +!! options +disabled +!! input +:;t1 +::::d2 +!! result +<dl> + <dd> + <dl> + <dt>t1</dt> + <dd> + <dl> + <dd> + <dl> + <dd>d2</dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> +</dl> + +!! end + + +!! test +Definition Lists: Nesting: Test 4 +!! input +::;t3 +:::d3 +!! result +<dl><dd><dl><dd><dl><dt>t3 +</dt><dd>d3 +</dd></dl> +</dd></dl> +</dd></dl> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 1 +!! input +:;* foo +::* bar +:; baz +!! result +<dl><dd><dl><dt><ul><li> foo +</li><li> bar +</li></ul> +</dt></dl> +<dl><dt> baz +</dt></dl> +</dd></dl> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 2 +!! input +*: d1 +*: d2 +!! result +<ul><li><dl><dd> d1 +</dd><dd> d2 +</dd></dl> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 3 +!! input +*::: d1 +*::: d2 +!! result +<ul><li><dl><dd><dl><dd><dl><dd> d1 +</dd><dd> d2 +</dd></dl> +</dd></dl> +</dd></dl> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 4 +!! input +*;d1 :d2 +*;d3 :d4 +!! result +<ul><li><dl><dt>d1 </dt><dd>d2 +</dd><dt>d3 </dt><dd>d4 +</dd></dl> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 5 +!! input +*:d1 +*:: d2 +!! result +<ul><li><dl><dd>d1 +<dl><dd> d2 +</dd></dl> +</dd></dl> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 6 +!! input +#*:d1 +#*::: d3 +!! result +<ol><li><ul><li><dl><dd>d1 +<dl><dd><dl><dd> d3 +</dd></dl> +</dd></dl> +</dd></dl> +</li></ul> +</li></ol> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 7 +!! input +:* d1 +:* d2 +!! result +<dl><dd><ul><li> d1 +</li><li> d2 +</li></ul> +</dd></dl> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 8 +!! input +:* d1 +::* d2 +!! result +<dl><dd><ul><li> d1 +</li></ul> +<dl><dd><ul><li> d2 +</li></ul> +</dd></dl> +</dd></dl> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 9 +!! input +*;foo :bar +!! result +<ul><li><dl><dt>foo </dt><dd>bar +</dd></dl> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 10 +!! input +*#;foo :bar +!! result +<ul><li><ol><li><dl><dt>foo </dt><dd>bar +</dd></dl> +</li></ol> +</li></ul> + +!! end + + +!! test +Definition Lists: Mixed Lists: Test 11 +!! input +*#*#;*;;foo :bar +*#*#;boo :baz +!! result +<ul><li><ol><li><ul><li><ol><li><dl><dt>foo </dt><dd><ul><li><dl><dt><dl><dt>bar +</dt></dl> +</dd></dl> +</li></ul> +</dd></dl> +<dl><dt>boo </dt><dd>baz +</dd></dl> +</li></ol> +</li></ul> +</li></ol> +</li></ul> + +!! end + + +!! test +Definition Lists: Weird Ones: Test 1 +!! input +*#;*::;; foo : bar (who uses this?) +!! result +<ul><li><ol><li><dl><dt> foo </dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?) +</dt></dl> +</dd></dl> +</dd></dl> +</dd></dl> +</li></ul> +</dd></dl> +</li></ol> +</li></ul> + +!! end ### ### External links @@ -914,6 +1604,23 @@ External links: [IDN ignored character reference in hostname; strip it right off </p> !! end +# FIXME: This test (the IDN characters in the text of a link) is an inconsistency. +# Where an external link could easily circumvent the sanitization of the text of +# a link like this (where an IDN-ignore character is in the URL somewhere), this +# test demands a higher standard. That's a bit strange. +# +# Example: +# +# http://example.com -> [http://example.com|http://example.com] +# [http://example.com|http://example.com] -> [http://example.com|http://example.com] +# +# The first example is sanitized, but the second is not. Any security benefits +# from this production are trivial to circumvent. Either remove this test and +# let the parser(s) do their thing unaccosted, or fix the inconsistency and change +# the test accordingly. +# +# All our love, +# The Parsoid team. !! test External links: IDN ignored character reference in hostname; strip it right off !! input @@ -1252,6 +1959,8 @@ Normal text. '''This year''''s election ''should'' beat '''last year''''s. ''Tom'''s car is bigger than ''Susan'''s. + +Plain ''italic'''s plain !! result <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i> </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b> @@ -1262,6 +1971,7 @@ Normal text. </p><p>Normal text. </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s. </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s. +</p><p>Plain <i>italic'</i>s plain </p> !! end @@ -2061,20 +2771,58 @@ Failing to transform badly formed HTML into correct XHTML </p> !!end -!! test +!! test Horizontal ruler (should it add that extra space?) -!! input +!! input <hr> <hr > foo <hr > bar -!! result +!! result <hr /> <hr /> foo <hr /> bar !! end +!! test +Horizontal ruler -- 4+ dashes render hr +!! input +---- +!! result +<hr /> + +!! end + +!! test +Horizontal ruler -- eats additional dashes on the same line +!! input +--------- +!! result +<hr /> + +!! end + +!! test +Horizontal ruler -- does not collaps dashes on consecutive lines +!! input +---- +---- +!! result +<hr /> +<hr /> + +!! end + +!! test +Horizontal ruler -- <4 dashes render as plain text +!! input +--- +!! result +<p>--- +</p> +!! end + ### ### Block-level elements ### @@ -2122,6 +2870,8 @@ Mixed list **#Number on level 3 *#number level 2 *Level 1 +*** Level 3 +#** Level 3, but ordered !! result <ul><li>Mixed list <ol><li> with numbers @@ -2144,11 +2894,127 @@ Mixed list <ol><li>number level 2 </li></ol> </li><li>Level 1 +<ul><li><ul><li> Level 3 </li></ul> +</li></ul> +</li></ul> +<ol><li><ul><li><ul><li> Level 3, but ordered +</li></ul> +</li></ul> +</li></ol> !! end !! test +Nested lists 1 +!! input +*foo +**bar +!! result +<ul><li>foo +<ul><li>bar +</li></ul> +</li></ul> + +!! end + +!! test +Nested lists 2 +!! input +**foo +*bar +!! result +<ul><li><ul><li>foo +</li></ul> +</li><li>bar +</li></ul> + +!! end + +!! test +Nested lists 3 (first element empty) +!! input +* +**bar +!! result +<ul><li> +<ul><li>bar +</li></ul> +</li></ul> + +!! end + +!! test +Nested lists 4 (first element empty) +!! input +** +*bar +!! result +<ul><li><ul><li> +</li></ul> +</li><li>bar +</li></ul> + +!! end + +!! test +Nested lists 5 (both elements empty) +!! input +** +* +!! result +<ul><li><ul><li> +</li></ul> +</li><li> +</li></ul> + +!! end + +!! test +Nested lists 6 (both elements empty) +!! input +* +** +!! result +<ul><li> +<ul><li> +</li></ul> +</li></ul> + +!! end + +!! test +Nested lists 7 (skip initial nesting levels) +!! input +*** foo +!! result +<ul><li><ul><li><ul><li> foo +</li></ul> +</li></ul> +</li></ul> + +!! end + +!! test +Nested lists 8 (multiple nesting transitions) +!! input +* foo +*** bar +** baz +* boo +!! result +<ul><li> foo +<ul><li><ul><li> bar +</li></ul> +</li><li> baz +</li></ul> +</li><li> boo +</li></ul> + +!! end + + +!! test List items are not parsed correctly following a <pre> block (bug 785) !! input * <pre>foo</pre> @@ -2162,6 +3028,57 @@ List items are not parsed correctly following a <pre> block (bug 785) !! end +!! test +List items from template +!! input + +{{inner list}} +* item 2 + +* item 0 +{{inner list}} +* item 2 + +* item 0 +* notSOL{{inner list}} +* item 2 +!! result +<ul><li> item 1 +</li><li> item 2 +</li></ul> +<ul><li> item 0 +</li><li> item 1 +</li><li> item 2 +</li></ul> +<ul><li> item 0 +</li><li> notSOL +</li><li> item 1 +</li><li> item 2 +</li></ul> + +!! end + +!! test +List interrupted by empty line or heading +!! input +* foo + +** bar +== A heading == +* Another list item +!! result +<ul><li> foo +</li></ul> +<ul><li><ul><li> bar +</li></ul> +</li></ul> +<h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2> +<ul><li> Another list item +</li></ul> + +!!end + + ### ### Magic Words ### @@ -2310,6 +3227,17 @@ title=[[User:Ævar Arnfjörð Bjarmason]] !! end !! test +Magic Word: {{NAMESPACENUMBER}} +!! options +title=[[User:Ævar Arnfjörð Bjarmason]] +!! input +{{NAMESPACENUMBER}} +!! result +<p>2 +</p> +!! end + +!! test Magic Word: {{NUMBEROFFILES}} !! input {{NUMBEROFFILES}} @@ -3482,15 +4410,15 @@ pst [[Bar:Article(context)|]] [[:Bar:Article(context)|]] [[|Article(context)]] -[[Bar:X (Y) Z|]] -[[:Bar:X (Y) Z|]] +[[Bar:X(Y)Z|]] +[[:Bar:X(Y)Z|]] !! result [[Article(context)|Article]] [[Bar:Article(context)|Article]] [[:Bar:Article(context)|Article]] [[Article(context)]] -[[Bar:X (Y) Z|X (Y) Z]] -[[:Bar:X (Y) Z|X (Y) Z]] +[[Bar:X(Y)Z|X(Y)Z]] +[[:Bar:X(Y)Z|X(Y)Z]] !! end !! test @@ -3534,6 +4462,26 @@ pst !! end !! test +pre-save transform: context links ("pipe trick") with commas (bug 21660) +!! options +pst +!! input +[[Article (context), context|]] +[[Article (context),context|]] +[[Bar:Article (context), context|]] +[[Bar:Article (context),context|]] +[[:Bar:Article (context), context|]] +[[:Bar:Article (context),context|]] +!! result +[[Article (context), context|Article]] +[[Article (context),context|Article]] +[[Bar:Article (context), context|Article]] +[[Bar:Article (context),context|Article]] +[[:Bar:Article (context), context|Article]] +[[:Bar:Article (context),context|Article]] +!! end + +!! test pre-save transform: trim trailing empty lines !! options pst @@ -3681,6 +4629,36 @@ msg No such special page !! end +!! test +{{#speciale:}} page name, known +!! options +msg +!! input +{{#speciale:Recentchanges}} +!! result +Special:RecentChanges +!! end + +!! test +{{#speciale:}} page name with subpage, known +!! options +msg +!! input +{{#speciale:Recentchanges/param}} +!! result +Special:RecentChanges/param +!! end + +!! test +{{#speciale:}} page name, unknown +!! options +msg +!! input +{{#speciale:foobarnonexistent}} +!! result +No_such_special_page +!! end + ### ### Images ### @@ -3734,7 +4712,7 @@ Image with link parameter, URL target !! input [[Image:foobar.jpg|link=http://example.com/]] !! result -<p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +<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> !! end @@ -3745,7 +4723,29 @@ Image with link parameter, wgExternalLinkTarget !! config wgExternalLinkTarget='foobar' !! result -<p><a href="http://example.com/" target="foobar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +<p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +</p> +!! end + +!! test +Image with link parameter, wgNoFollowLinks set to false +!! input +[[Image:foobar.jpg|link=http://example.com/]] +!! config +wgNoFollowLinks=false +!! result +<p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +</p> +!! end + +!! test +Image with link parameter, wgNoFollowDomainExceptions +!! input +[[Image:foobar.jpg|link=http://example.com/]] +!! config +wgNoFollowDomainExceptions='example.com' +!! result +<p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! end @@ -3756,7 +4756,7 @@ Image with link parameter, wgExternalLinkTarget, unnamed parameter !! config wgExternalLinkTarget='foobar' !! result -<p><a href="http://example.com/" title="Title" target="foobar"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +<p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> </p> !! end @@ -3783,7 +4783,7 @@ Image with link parameter (URL target) and unnamed parameter !! input [[Image:foobar.jpg|link=http://example.com/|Title]] !! result -<p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> +<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> !! end @@ -3999,6 +4999,15 @@ Bug 3090: External links other than http: in image captions !! end +!! test +Custom class +!! input +[[Image:foobar.jpg|a|class=b]] +!! result +<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> +!! end + !! article File:Barfoo.jpg !! text @@ -4524,6 +5533,30 @@ section 5 !! end !! test +Headers with excess '=' characters +(Are similar tests necessary beyond the 1st level?) +!! input +=foo== +==foo= +=''italic'' heading== +==''italic'' heading= +!! result +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li> +<li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li> +<li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li> +<li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li> +</ul> +</td></tr></table> +<h1><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1> +<h1><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1> +<h1><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1> +<h1><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1> + +!! end + +!! test BUG 1219 URL next to image (broken) !! input http://example.com[[Image:foobar.jpg]] @@ -6002,9 +7035,7 @@ Special page transclusion !! input {{Special:Prefixindex/Xyzzyx}} !! result -<p><br /> -</p> -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> +<table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> !! end @@ -6015,12 +7046,8 @@ Special page transclusion twice (bug 5021) {{Special:Prefixindex/Xyzzyx}} {{Special:Prefixindex/Xyzzyx}} !! result -<p><br /> -</p> -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> -<p><br /> -</p> -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> +<table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> +<table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> !! end @@ -8449,6 +9476,17 @@ wgUseDynamicDates=true </p> !! end +!! test +formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language +!! options +language=nl title=[[MediaWiki:Common.css]] +!! input +{{#formatdate:2009-03-24|dmy}} +!! result +<p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span> +</p> +!! end + # # # @@ -8897,22 +9935,6 @@ Bug 31098 Template which includes system messages which includes the template !! end !! test -Deprecated presentational attributes are converted to css -!! input -{| -| valign=top align=left width=100 height=25% | Asdf -|} -<ul type="disc"></ul> -!! result -<table> -<tr> -<td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf -</td></tr></table> -<ul style="list-style-type: disc;"></ul> - -!! end - -!! test Bug31490 Turkish: ucfirst 'blah' !! options language=tr @@ -9200,11 +10222,142 @@ nowiki inside link inside heading (bug 18295) !! end +!! test +new support for bdi element (bug 31817) +!! input +<p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p> +!! result +<p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p> + +!!end + +!! test +Ignore pipe between table row attributes +!! input +{| +| quux +|- id=foo | style='color: red' +| bar +|} +!! result +<table> +<tr> +<td> quux +</td></tr> +<tr id="foo" style="color: red"> +<td> bar +</td></tr></table> + +!! end + +!!test +Gallery override link with WikiLink (bug 34852) +!! input +<gallery> +File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink +</gallery> +!! result +<ul class="gallery"> + <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="gallerytext"> +<p>caption +</p> + </div> + </div></li> +</ul> + +!! end + +!!test +Gallery override link with absolute external link (bug 34852) +!! input +<gallery> +File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org +</gallery> +!! result +<ul class="gallery"> + <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="gallerytext"> +<p>caption +</p> + </div> + </div></li> +</ul> + +!! end + +!!test +Gallery override link with malicious javascript (bug 34852) +!! input +<gallery> +File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!'); +</gallery> +!! result +<ul class="gallery"> + <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/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> + <div class="gallerytext"> +<p>caption +</p> + </div> + </div></li> +</ul> + +!! end + +!!test +Language parser function +!! input +{{#language:ar}} +!! result +<p>العربية +</p> +!! end + +!!test +Padleft and padright as substr +!! input +{{padleft:|3|abcde}} +{{padright:|3|abcde}} +!! result +<p>abc +abc +</p> +!! end + +!!test +Bug 34939 - Case insensitive link parsing ([HttP://]) +!! input +[HttP://MediaWiki.Org/] +!! result +<p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a> +</p> +!! end + +!!test +Bug 34939 - Case insensitive link parsing ([HttP:// title]) +!! input +[HttP://MediaWiki.Org/ MediaWiki] +!! result +<p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a> +</p> +!! end + +!!test +Bug 34939 - Case insensitive link parsing (HttP://) +!! input +HttP://MediaWiki.Org/ +!! result +<p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a> +</p> +!! end + TODO: more images more tables -math character entities and much more Try for 100% code coverage |