X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FparserTests.txt;h=b18f1e7a34ae4fbebfddc0e5c56735900e7efdf3;hb=05ca28bba0e65e17428d274043a8b765d08583eb;hp=5b17eacab07d7a3cb80ccbaddc5e83c621d24e10;hpb=ea42d90053b36cef47f318a1d50c18dfafc6b7b8;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 5b17eacab0..b18f1e7a34 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -271,6 +271,12 @@ Template:EmptyTRWithHTMLAttrTest
!!endarticle
+!! article
+Template:CircularRef
+!! text
+[{{CircularRef}}]
+!! endarticle
+
###
### Basic tests
###
@@ -280,6 +286,15 @@ Blank input
!! html
!! end
+!! test
+CircularRef
+!! wikitext
+{{CircularRef}}
+
+!! html/parsoid
+
[1]
+- â Error: Expansion loop detected at Template:CircularRef
+!! end
!! test
Simple paragraph
@@ -2727,6 +2742,10 @@ Templates: Handle comments in the target
|foo}}
+{{echo
+
+ |foo}}
+
{{echo
|foo}}
@@ -2738,10 +2757,13 @@ Templates: Handle comments in the target
foo
foo
foo
+
foo
!! html/parsoid
foo
+foo
+
foo
foo
@@ -3686,7 +3708,6 @@ Definition and unordered list using wiki syntax nested in unordered list using h
!! end
!! test
-
Definition list with empty definition and following paragraph
!! wikitext
; term:
@@ -7596,8 +7617,6 @@ Link with multiple pipes
!! end
-# Note that parsoid does not munge anchor text; all non-space
-# characters are valid in HTML5 ids.
!! test
Anchor containing a #. (bug 63430)
!! wikitext
@@ -7606,7 +7625,7 @@ Anchor containing a #. (bug 63430)
Main Page#And#Link
!! html/parsoid
-Main Page#And#Link
+Main Page#And#Link
!! end
!! test
@@ -7721,18 +7740,16 @@ Link containing % as a double hex sequence interpreted to hex sequence
!!end
-# note that parsoid does not munge anchor text; all non-space
-# characters are valid in HTML5 anchors.
+## Example for such a section: == < ==
!! test
Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
-Example for such a section: == < ==
!! wikitext
[[%23%3c]][[%23%3e]]
!! html/php
#<#>
!! html/parsoid
-#<#>
+#<#>
!! end
!! test
@@ -8252,7 +8269,7 @@ Link with angle bracket after anchor
Foo#<bar>
!! html/parsoid
-Foo#<bar>
+Foo#<bar>
!! end
###
@@ -8310,6 +8327,23 @@ Interwiki link with fragment (bug 2130)
!! end
+!! test
+Link scenarios with escaped fragments
+!! wikitext
+[[#Is this great?]]
+[[Foo#Is this great?]]
+[[meatball:Foo#Is this great?]]
+!! html/php
+#Is this great?
+Foo#Is this great?
+meatball:Foo#Is this great?
+
+!! html/parsoid
+#Is this great?
+Foo#Is this great?
+meatball:Foo#Is this great?
+!! 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',
@@ -10374,7 +10408,6 @@ language=de
!! end
-
!! test
Urlencode
!! wikitext
@@ -10382,7 +10415,7 @@ Urlencode
{{urlencode:hi world?!|WIKI}}
{{urlencode:hi world?!|PATH}}
{{urlencode:hi world?!|QUERY}}
-!! html
+!! html/php
hi+world%3F%21
hi_world%3F!
hi%20world%3F%21
@@ -15929,7 +15962,7 @@ parsoid=wt2html,html2html
HTML rocks
!! html/parsoid
-HTML rocks
+HTML rocks
!! end
!! test
@@ -17107,9 +17140,11 @@ Table not started
Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
!! wikitext
byte[[#æ: v|backlink]]
-!! html
+!! html/php
bytebacklink
+!! html/parsoid
+bytebacklink
!! end
# In HTML5, the restrictions are that id must contain at least one character,
@@ -18858,8 +18893,14 @@ title=[[Parser test]]
!! end
### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
+## Parsoid thinks the "centre" here is a property, not a caption.
!! test
Gallery
+!! options
+parsoid={
+ "modes": ["wt2html"],
+ "nativeGallery": true
+}
!! wikitext
image1.png |
@@ -18871,7 +18912,7 @@ image4 |300px| centre
[[x|xx]]]]
* image6
-!! html
+!! html/php
Image1.png
@@ -18909,19 +18950,94 @@ image4 |300px| centre
+!! html/parsoid
+
+image1.png
+image2.gif
+image3
+image4
+ image5.svg
+* image6
+
!! end
!! test
-Gallery (with options)
+Gallery (with options, html)
+!! options
+parsoid={
+ "modes": ["wt2html", "html2html"],
+ "nativeGallery": true
+}
!! wikitext
-
+
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.
-!! html
+!! html/php
+
+
+!! html/parsoid
+
+- Foo Main Page
+File:Nonexistent.jpg
caption
+File:Nonexistent.jpg
+
+
+blabla.
+
+!! end
+
+!! test
+Gallery (with options, extsrc)
+!! options
+parsoid={
+ "nativeGallery": false
+}
+!! wikitext
+
+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.
+
+!! html/php
+!! html/parsoid
+
+- Foo Main Page
+File:Nonexistent.jpg
caption
+File:Nonexistent.jpg
+
+
+blabla.
+
!! end
!! test
Gallery with link that has fragment
+!! options
+parsoid={
+ "modes": ["wt2html", "html2html"],
+ "nativeGallery": true
+}
!! wikitext
image:foobar.jpg|link=Main_Page
image:foobar.jpg|link=Main_Page#section
image:foobar.jpg|link=Main Page#section|caption
-!! html
+!! html/php
@@ -18988,16 +19118,56 @@ image:foobar.jpg|link=Main Page#section|caption
+!! html/parsoid
+
+!! end
+
+## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
+!! test
+Gallery with template inside caption
+!! options
+parsoid={
+ "nativeGallery": true
+}
+!! wikitext
+
+File:Foobar.jpg|{{echo|ho}}
+
+!! html/php
+
+
+!! html/parsoid
+
!! end
!! test
Gallery with wikitext inside caption
+!! options
+parsoid={
+ "nativeGallery": true
+}
!! wikitext
-File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
-File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
+File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
+File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
-!! html
+!! html/php
@@ -19015,18 +19185,27 @@ File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
+!! html/parsoid
+
+
+This is a test template
+
!! end
!! test
-gallery (with showfilename option)
+Gallery (with showfilename option)
+!! options
+parsoid={
+ "nativeGallery": true
+}
!! wikitext
-
+
File:Nonexistent.jpg|caption
File:Nonexistent.jpg
-image:foobar.jpg|some '''caption''' [[Main Page]]
+File:Foobar.jpg|some '''caption''' [[Main Page]]
File:Foobar.jpg
-!! html
+!! html/php
Nonexistent.jpg
@@ -19060,10 +19239,23 @@ some
caption Main Page
+!! html/parsoid
+
+File:Nonexistent.jpg
+File:Nonexistent.jpg
+
+
+
!! end
+## Should Parsoid be preserving these variations?
!! test
Gallery (with namespace-less filenames)
+!! options
+parsoid={
+ "modes": ["wt2html", "html2html"],
+ "nativeGallery": true
+}
!! wikitext
File:Nonexistent.jpg
@@ -19071,7 +19263,7 @@ Nonexistent.jpg
image:foobar.jpg
foobar.jpg
-!! html
+!! html/php
Nonexistent.jpg
@@ -19095,6 +19287,115 @@ foobar.jpg
+!! html/parsoid
+
+File:Nonexistent.jpg
+Nonexistent.jpg
+
+
+
+!! end
+
+!! test
+Gallery override link with WikiLink (T36852)
+!! options
+parsoid={
+ "nativeGallery": true
+}
+!! wikitext
+
+File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
+
+!! html/php
+
+
+!! html/parsoid
+
+!! end
+
+!! test
+Gallery override link with absolute external link (T36852)
+!! options
+parsoid={
+ "nativeGallery": true
+}
+!! wikitext
+
+File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
+
+!! html/php
+
+
+!! html/parsoid
+
+!! end
+
+!! test
+Gallery override link with malicious javascript (T36852)
+!! options
+parsoid={
+ "modes": ["wt2html", "html2html"],
+ "nativeGallery": true
+}
+!! wikitext
+
+File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
+
+!! html/php
+
+
+!! html/parsoid
+
+!! end
+
+!! test
+Gallery with invalid title as link (T45964)
+!! options
+parsoid={
+ "modes": ["wt2html", "html2html"],
+ "nativeGallery": true
+}
+!! wikitext
+
+File:Foobar.jpg|link=<
+
+!! html/php
+
+
+!! html/parsoid
+
!! end
!! test
@@ -20294,6 +20595,17 @@ language=sr variant=sr-ec
!! end
+!! test
+T146304: Don't break template parsing if language converter markup is in the parameter.
+!! options
+language=sr variant=sr-ec
+!! wikitext
+{{echo|-{R|foo}-}}
+!! html/php
+foo
+
+!! end
+
# 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.
@@ -20954,7 +21266,7 @@ Edit comment with link with more than one pipe (T99346)
comment
!! wikitext
[[Main Page|Many|pipes]]
-!! html
+!! html/php
Many|pipes
!! end
@@ -20964,7 +21276,7 @@ Complex edit comment with link with more than one pipe (T99346)
comment
!! wikitext
Created page with "[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]] === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
-!! html
+!! html/php
Created page with "<noinclude>{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</noinclude> === User:MineoBot 8=== {{Request for permissions/links|Mineo..."
!! end
@@ -21765,7 +22077,7 @@ Strip marker in urlencode
{{urlencode:xy|wiki}}
{{urlencode:xy|path}}
{{urlencode:xtwo
y}}
-!! html
+!! html/php
xy
xy
xy
@@ -21903,81 +22215,7 @@ Ignore pipe between table row attributes
!! end
-!!test
-Gallery override link with WikiLink (bug 34852)
-!! wikitext
-
-File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
-
-!! html
-
-
-!! end
-
-!!test
-Gallery override link with absolute external link (bug 34852)
-!! wikitext
-
-File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
-
-!! html
-
-
-!! end
-
-!!test
-Gallery override link with malicious javascript (bug 34852)
-!! wikitext
-
-File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
-
-!! html
-
-
-!! end
-
-!!test
-Gallery with invalid title as link (bug 43964)
-!! wikitext
-
-File:foobar.jpg|link=<
-
-!! html
-
-
-!! end
-
-!!test
+!! test
Language parser function
!! wikitext
{{#language:ar}}
@@ -22394,19 +22632,20 @@ Ref: 13. ref-tags are not SOL-transparent and block indent-pres
!!end
-!!test
+## Roundtripping fails because of nowiki'ing
+!! test
Ref: 14. A nested ref-tag should be emitted as plain text
+!! options
+parsoid=wt2html
!! wikitext
[foo ][bar] baz
!! html/parsoid
-[1]
-
-
-- â foo <ref>bar</ref> baz
-
-!!end
+[1] baz</ref>
+
+- â foo <ref>bar
+!! end
!!test
Ref: 15. ref-tags with identical names should get identical indexes
@@ -22725,24 +22964,6 @@ foo
foo
!! 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
-!! options
-parsoid={ "suppressErrors": true }
-!! wikitext
-
-
-!! html/parsoid
-
-
-!! end
-
#--------- Test stripping of empty nodes in template content ----------
!!test
Empty LI and TR nodes should be stripped from template content
@@ -26395,6 +26616,93 @@ parsoid=html2wt,wt2wt
!! end
+!! test
+T149209: WTS: Handle newlines in table cells properly
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+
+!! wikitext
+{|
+|a
+b
+|c
+|-
+|x
+{{!}}y
+|}
+{|
+!a
+b
+!c
+|-
+!x
+!y
+|}
+!! end
+
+!! test
+T149209: Selser: Handle newlines in table cells properly
+!! options
+parsoid={
+ "modes": ["selser"],
+ "changes": [
+ [ "#h1", "html", "a\nb\n" ],
+ [ "#h2", "html", "a\nb\n" ],
+ [ "#c1", "html", "a\nb\n" ],
+ [ "#c2", "html", "a
" ],
+ [ "#c3", "html", "a
" ]
+ ]
+}
+!! wikitext
+{|
+! id="h1" |edit-me!!1
+|-
+! id="h2" |edit-me||2
+|-
+| id="c1" |edit-me||3
+|-
+| id="c2" |edit-me||4
+|-
+| id="c3" |edit-me||p||q||r
+|}
+!! wikitext/edited
+{|
+! id="h1" |a
+b
+!1
+|-
+! id="h2" |a
+b
+!2
+|-
+| id="c1" |a
+b
+|3
+|-
+| id="c2" |a
+|4
+|-
+| id="c3" |a
+|p||q||r
+|}
+!! end
+
!! test
HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
!! options