aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/parserTests.txt
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2024-09-11 11:49:04 -0400
committerC. Scott Ananian <cscott@cscott.net>2024-09-13 14:42:27 -0400
commit25da9113349a2764935366493d74d49528e5c91f (patch)
tree9ebeedefa9c1411f67acd4f7e85be1e3be62b54f /tests/parser/parserTests.txt
parentc573e946fe215921da145b997172817e81ea3f22 (diff)
downloadmediawikicore-25da9113349a2764935366493d74d49528e5c91f.tar.gz
mediawikicore-25da9113349a2764935366493d74d49528e5c91f.zip
Parser tests: add additional options to test ParserOutput metadata
New options added: `iwl`, `links`, `special`, `extlinks`, and `templates`, and handling of existing `ill` option tweaked to be consistent. Added some tests to exercise these options, focusing on the handling of title fragments. Attempted to make the output formatting consistent among options; a future unification (I32df68714ffdf2f0745b974f47bc3ccceef1f41c) should help DRY these out further. Bug: T310512 Change-Id: Ic9c766ae4362969de124ad9d66eb47cfa68395c6
Diffstat (limited to 'tests/parser/parserTests.txt')
-rw-r--r--tests/parser/parserTests.txt52
1 files changed, 49 insertions, 3 deletions
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index c3afef2fe34a..1a797369f519 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -24,7 +24,12 @@ version=2
# (Previously, these options pre- or post- pended to the html section)
#
# cat add category links
+# extlinks add external link metadata
# ill add inter-language links
+# iwl add inter-wiki links
+# links add local wiki links
+# special add links to special pages
+# templates add template information
# property=XXX add the value of the page property with the given name.
# This can also be a comma-separated list.
# extension=XXX add the JSON-encoded value of the given extension data.
@@ -1138,9 +1143,14 @@ maxtemplatedepth=1
!! test
multiple templates that are redirects
+!! options
+templates
!! wikitext
{{redirect to foo}}
{{redirect to foo}}
+!! metadata
+template=Template:Redirect_to_foo
+template=Template:Foo
!! html/php
<p>FOO
FOO
@@ -1151,6 +1161,21 @@ FOO
!! end
!! test
+Transclusion with a (stripped) fragment
+!! options
+templates
+!! wikitext
+{{Foo#bar}}
+!! metadata
+template=Template:Foo
+!! html/php
+<p>FOO
+</p>
+!! html/parsoid+integrated
+<p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Foo#bar","href":"./Template:Foo#bar"},"params":{},"i":0}}]}'>FOO</span></p>
+!! end
+
+!! test
T53086: Double newlines in blockquotes should be turned into paragraphs
!! wikitext
<blockquote>
@@ -1873,8 +1898,12 @@ Broken link
# Parsoid does not. (T227693)
!! test
Broken link with fragment
+!! options
+links
!! wikitext
[[Zigzagzogzagzig#zug]]
+!! metadata
+link=Zigzagzogzagzig
!! html/php
<p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
</p>
@@ -1884,8 +1913,12 @@ Broken link with fragment
!! test
Special page link with fragment
+!! options
+special
!! wikitext
[[Special:Version#anchor]]
+!! metadata
+special=Special:Version
!! html
<p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
</p>
@@ -2013,8 +2046,12 @@ Link with multiple pipes
Anchor containing a #. (T65430)
!! config
wgFragmentMode=[ "html5", "legacy" ]
+!! options
+links
!! wikitext
[[Main Page#And#Link]]
+!! metadata
+link=Main_Page
!! html/php
<p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
</p>
@@ -6912,8 +6949,11 @@ blah
!! test
Link to category
+!! options
+cat
!! wikitext
[[:Category:MediaWiki User's Guide]]
+!! metadata
!! html
<p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
</p>
@@ -7615,7 +7655,9 @@ ill
[[fr:Nourriture]]
[[zh:食品]]
!! metadata
-es:Alimento fr:Nourriture zh:食品
+ill=es:Alimento
+ill=fr:Nourriture
+ill=zh:食品
!! html/php
!! html/parsoid
<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
@@ -7635,9 +7677,13 @@ ill
[[fr:1]]
[[fr:2]]
!! metadata/php
-es:1 fr:1
+ill=es:1
+ill=fr:1
!! metadata/parsoid
-es:1 es:2 fr:1 fr:2
+ill=es:1
+ill=es:2
+ill=fr:1
+ill=fr:2
!! html/php
!! html/parsoid
<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>