!! Version 2
!! article
Template:1x
!! text
{{{1}}}
!! endarticle
# TODO: add a test for T295168 when tackling it
!! test
Continue to serialize the old annotated 2.3.0 html
!! options
parsoid=html2wt
annotations=1
!! html/parsoid
foo
foo
bar
baz
foo
bar
baz
!! wikitext
foo
foo
bar
baz
foo
bar
baz
!! end
!! test
Whole content between dummyanno tags
!! options
annotations=1
!! wikitext
==Title==
Let's have some text.
!! html/parsoid
Title
Let's have some text.
!! end
!! test
Inline dummyanno tags
!! options
annotations=1
!! wikitext
Some text with some annotated content inline.
!! html/parsoid
Some text with some annotated content inline.
!! end
!! test
Template inside a dummyanno tag should not make a difference on its handling
!! options
annotations=1
!! wikitext
{{1x|
== Title ==
}}
Let's have some text.
!! html/parsoid
Title
Let's have some text.
!! end
!! test
Two inline dummyanno tags should have different rangeIds
!! options
annotations=1
!! wikitext
Some inline text followed by some more text inline
!! html/parsoid
Some inline text followed by some more text inline
!! end
!! test
Two dummyanno tags on new lines should have different rangeIds
!! options
annotations=1
!! wikitext
Some
text
followed by
some more text
to dummyanno
!! html/parsoid
Some
text
followed by
some more text
to dummyanno
!! end
!! test
Name attribute in ann2 tags should be added to the meta tag
!! options
annotations=1
!! wikitext
Some text with some undummyannod content inline.
!! html/parsoid
Some text with some undummyannod content inline.
!! end
!! test
Annotation wrapping an entire paragraph should be nested inside the paragraph
!! options
annotations=1
!! wikitext
foo
barbaz
!! html/parsoid
foo
bar
baz
!! end
!! test
Two paragraphs between dummyanno tags should roundtrip without duplicating the tags (DSRs are adjusted correctly)
!! options
annotations=1
!! wikitext
plop
Let's have some text.
!! html/parsoid
plop
Let's have some text.
!! end
!! test
Start dummyanno tag at the beginning of a paragraph and end within should extend to the end of but not the whole paragraph
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
This should ''fail miserably'' ... let's fix it
!! html/parsoid here
This should fail miserably ... let's fix it
!! end
!! test
End dummyanno tag at the end of a paragraph and beginning within should extend to the end of but not the whole paragraph
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
This should ''fail miserably'' ... let's fix it
!! html/parsoid here
This should fail miserably ... let's fix it
!! end
!! test
Meta merging with annotations/template should not happen
!! options
annotations=1
!! wikitext
{{1x|stuff}}
!! html/parsoid
stuff
!! end
!! test
Meta merging with template/annotation is fine
!! options
annotations=1
!! wikitext
{{1x|stuff}}
!! html/parsoid
stuff
!! end
!! test
Attributes without value should be transferred to and back from the meta tag
!! options
annotations=1
!! wikitext
some stuff
!! html/parsoid
some stuff
!! end
!! test
Annotation open tag in fosterable position should expand the range to the entire table
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
{|
|table
|with
|-
|some
|content
|-
|dummyanno
|one line
|}
!! html/parsoid
table
with
some
content
dummyanno
one line
!! end
!! test
dummyanno in the middle of fostered content should extend to the whole range, including fostered content
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
{|
foo
bar
|-
|baz
|}
!! html/parsoid
foo
bar
baz
!!end
# This test explicitly tests that template continuity is not broken by top-level annotation markers. Observe that the
# end annotation marker is rendered before the table and not after it as one would expect. This is due to the fact that
# the table itself is transclusion content, which prevents the creation of the FosterBox. Hence, the end annotation is
# not detected as being fostered. This is fine because the transclusion prevents block-level DOM editing of the content,
# which will avoid round-tripping issues.
!!test
dummyanno getting roped to template top-level because of fostering should get the about attribute of the template
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
{{1x|Some text!
first fostered
table
}}
stuff
last fostered
!! html/parsoid
Some text!
first fostered
last fostered
table
stuff
!!end
# As opposed to the previous test, the transclusion is now in fostered content directly. The annotation markers are
# entered in the foster box, and then treated as such. The whole content is wrapped in ExtendedAnnRange div and in the
# transclusion (both annotation tags get the transclusion about tag).
!! test
Annotations and templates in the fosterbox
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
hello
{{1x|world}}
plop
!! html/parsoid
world
plop
hello
!! end
!! test
Fostering of nested annotation ranges
!! options
parsoid={
"modes": ["wt2html"]
}
annotations=1
!! wikitext
plop
cell
!! html/parsoid
plop
cell
!! end
!! test
Fostering of contiguous annotation ranges
!! options
parsoid={
"modes": ["wt2html"]
}
annotations=1
!! wikitext
plopreplop
cell
!! html/parsoid
plop
replop
cell
!! end
!! test
dummyanno tags around
area with new lines
!! options
annotations=1
!! wikitext
foo
!! html/parsoid
foo
!! end
!! test
Newlines should be inserted between annotation tags and pre
!! options
parsoid={
"modes": ["html2wt"]
}
annotations=1
!! html/parsoid
foo
bar
baz
foo
bar
baz
!! wikitext
foo
bar
baz
foo
bar
baz
!! end
!! test
dummyanno tags in list items
!! options
annotations=1
!! wikitext
*List item!
!! html/parsoid
List item!
!! end
### Tests from annotation spec
!! test
1/ Whole content contained in annotation tags
!! options
annotations=1
!! wikitext
One paragraph.
And another.
!! html/parsoid
One paragraph.
And another.
!! end
!! test
2/ Extended annotation range
!! options
parsoid={
"modes": ["wt2html", "selser","wt2wt"]
}
annotations=1
!! wikitext
This is ''an artificial'' '''example of''' extension.
!! html/parsoid
This is an artificialexample of extension.
!! end
!! test
3/ Two types of annotation, nested; annotation attributes
!! options
annotations=1
!! wikitext
Some text with a variable in the middle
!! html/parsoid
Some text with a variable in the middle
!! end
!! test
4/ Template (fully enclosed) in annotation range
!! options
annotations=1
!! wikitext
aa bb {{1x|some content}} bb aa
!! html/parsoid
aa bb some content bb aa
!! end
!! test
5/ annotation (fully enclosed) in template
!! options
annotations=1
!! wikitext
{{1x|bb some content bb}} aa
!! html/parsoid
bb some content bb aa
!! end
!! test
7/ attributes in annotations
!! options
annotations=1
!! wikitext
{|
|-
| style="background: red; color: white;" |abc
|jkl
|}
!! html/parsoid
!!end
!! test
Selser: add a paragraph at the end of the content should not make the tag disappear
!! options
parsoid={
"modes": ["selser"],
"changes": [
["p", "after", "
plop
"]
]
}
annotations=1
!! wikitext
==plop==
Add another paragraph.
!! wikitext/edited
==plop==
Add another paragraph.
plop
!!end
!! test
Selser: add content at the end of a paragraph with badly nested content with annotation
!! options
parsoid={
"modes": ["selser"],
"changes": [
["p", "append", "something"]
]
}
annotations=1
!! wikitext
Some ''stuff and '''also some'' more stuff''' than that.
!! wikitext/edited
Some ''stuff and '''also some'' more stuff''' than that.something
!! end
!! test
Selser: add content at the end of a paragraph with badly nested content without annotation
!! options
annotations=1
!! wikitext
Some ''stuff and '''also some'' more stuff''' than that.
!! html/parsoid
Some stuff and also some more stuff than that.
!! end
!! test
Selser: add content before and after and tags should keep paragraphs
!! options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "before", "
plop
"],
["meta", "after", "
plop2
"]
]
}
annotations=1
!! wikitext
hello
!! wikitext/edited
plop
plop2
hello
plop
plop2
!! end
!! test
Selser: add content before and tags should keep paragraphs
!! options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "before", "
plop
"]
]
}
annotations=1
!! wikitext
hello
!! wikitext/edited
plop
hello
plop
!! end
!! test
Selser: add content after and tags should keep paragraphs
!! options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "after", "
plop2
"]
]
}
annotations=1
!! wikitext
hello
!! wikitext/edited
plop2
hello
plop2
!! end
!! test
Selser: add headings after and tags should yield the right amount of new lines
!!options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "after", "
plop
"]
]
}
annotations=1
!! wikitext
==title==
some paragraph
hello
some other paragraph
!! wikitext/edited
==title==
some paragraph
== plop ==
hello
== plop ==
some other paragraph
!! end
!! test
Selser: add headings before and tags should yield the right amount of new lines
!!options
parsoid={
"modes": ["selser","wt2wt"],
"changes": [
["meta", "before", "
plop
"]
]
}
annotations=1
!!wikitext
==title==
some paragraph
hello
some other paragraph
!!wikitext/edited
==title==
some paragraph
== plop ==
hello
== plop ==
some other paragraph
!! end
!! test
Selser: add lists before and tags should yield the right amount of new lines
!! options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "before", "
plop
"]
]
}
annotations=1
!! wikitext
==title==
some paragraph
hello
some other paragraph
!!wikitext/edited
==title==
some paragraph
* plop
hello
* plop
some other paragraph
!! end
!! test
Selser: add lists after and tags should yield the right amount of new lines
!!options
parsoid={
"modes": ["selser"],
"changes": [
["meta", "after", "
plop
"]
]
}
annotations=1
!! wikitext
==title==
some paragraph
hello
some other paragraph
!!wikitext/edited
==title==
some paragraph
* plop
hello
* plop
some other paragraph
!! end
!! test
T295330 - dsr computation should allow proper selser
!! options
annotations=1
!! wikitext
'''The quick brown fox jumps over the lazy dog.'''
[[Category:Foo]]
!! html/parsoid
The quick brown fox jumps over the lazy dog.
!! end
## FIXME: This is currently awkward where only the start of the dummyanno is pulled into the template range.
## This doesn't affect correctness because the ranges are all marked extended (because of bad nesting).
## But, the bad nesting is an artefact of how the paragraph wrapper leaves the opening and closing meta
## tags of the annotation range in different paragraphs, and one of those paragraphs happen to be from
## a template. If the p-wrapper can be tweaked to be smarter about this, this will get cleaned up better.
## But, for now, the focus is on not breaking selser.
!! test
Top-level metas should not be migrated into paragraphs, nor pulled in the template
!! options
parsoid=wt2html,selser,wt2wt
annotations=1
!! wikitext
{{1x|
a
b}}
c
!! html/parsoid
a
b
c
!! end
!! test
Annotations should not be hoisted out of headers
!! wikitext
== Organizational and Planning Projects==
!! options
annotations=1
!! html/parsoid
Organizational and Planning Projects
!! end
# Fixing T296169 in an imperfect way - see AnnotationDOMRangeBuilder.php#removeNestedRanges for details
# This test purposefully fails on wt2wt, but we want to keep the output as part of the tests results.
# Selser failures are also due to the wt2wt discrepancy.
!! test
T296169: Nested annotations should be dropped in HTML output
!! options
parsoid={
"modes": ["wt2html", "selser", "wt2wt"]
}
annotations=1
!! wikitext
t1t2t3
!! html/parsoid
t1 t2 t3
!! end
# T296169
!! test
T296169: Extended annotations that yield a nested annotation should not nest said annotation
!! options
parsoid={
"modes": ["wt2html", "selser", "wt2wt"]
}
annotations=1
!! wikitext
a ''b'' c ''d e f'' g
!! html/parsoid
a b c d e f g
!! end
!! test
# This is not correct yet because the template is not expanded in the HTML - the template is considered as a raw string
# instead. Follow-up as T299523.
Annotations with templated annotation attribute shouldn't emit a warning and should round-trip
!! options
annotations=1
!! wikitext
test
!! html/parsoid
test
!! end
!! test
Annotations with templated annotation attribute name shouldn't emit a warning and should round-trip
!! options
annotations=1
!! wikitext
test
!! html/parsoid
test
!! end
!! test
Annotations with templated annotation attribute value shouldn't emit a warning and should round-trip
!! options
annotations=1
!! wikitext
test
!! html/parsoid
test
!! end
!! test
Annotation around a heading should not break the heading
!! options
annotations=1
!! wikitext
==plop==
!! html/parsoid
plop
!! end
!! test
New lines around table-spanning annotation range extension should be maintained in selser
!! options
annotations=1
parsoid=wt2html,wt2wt,selser
!! wikitext
txt1
{|
|-
txt2
|text3
|}
txt4
!! html/parsoid
txt1
txt2
text3
txt4
!! end
!! test
Extended ranges should not result in bad nesting (T306186)
!! options
annotations=1
parsoid=wt2html,selser
!! wikitext
text
by someone
Highway of Montenegro.
by Albin Olsson, CC BY-SA 4.0.
Greta Salóme, singing for Iceland.
by Albin Olsson, CC BY-SA 4.0.
Nina Kraljić, representing Croatia.
!! html/parsoid
text
by someone
Highway of Montenegro.
by Albin Olsson, CC BY-SA 4.0.
Greta Salóme, singing for Iceland.
by Albin Olsson, CC BY-SA 4.0.
Nina Kraljić, representing Croatia.
!! end
# Looks like the comment, and the whitespace before 'Purge' are all needed.
# Also, adding anything before the {{{1|..}} also leads to the test passing
# without the T307172 fix.
# So, this is a narrow edge case specific to this wikitext form.
!! test
T307172 Regression test
!! options
annotations=1
parsoid=wt2html
!! wikitext
{{{1| Purge}}}
!! html/parsoid
Purge
!! end
!! test
Should handle poorly nested range - T325575
!! options
annotations=1
parsoid=wt2html
!! wikitext
hello
!! html/parsoid
hello
!! end
!! test
Fostering in div - "end" tag should be after the "start" tag
!! options
annotations=1
parsoid=wt2html
!! wikitext
some stuff
hello
hello
!! html/parsoid
hello
some stuff
hello
!! end
# The wt2wt test here is failing because of the start tags (which displays another issue, but which is independent from fostering).
# But this way we can test that the end tags get included in the transclusion as they should, at least.
!! test
Fostering in div with fostered transclusion should extend the transclusion on the end annotation tag
!! options
annotations=1
parsoid=wt2html,wt2wt
!! wikitext
some stuff
{{1x|transclusion}}
hello
hello
!! html/parsoid
transclusion
hello
some stuff
hello
!! end
!! test
Doubly-closed ranges should be processed with the following end tags ignored
!! options
annotations=1
parsoid=wt2html
!! wikitext
!! html/parsoid
</dummyanno>
!! end
!! test
Triply-closed ranges should be processed with the following end tags ignored
!! options
annotations=1
parsoid=wt2html
!! wikitext
!! html/parsoid
</dummyanno></dummyanno>
!! end
!! test
Annotation in template target
!! options
annotations=1
!! wikitext
{{1x|hello stuff}}
!! html/parsoid
hello</dummyanno> stuff
!! end
# Note that mw:Extension isn't registered as a 'real' interwiki link in
# the parser test runner, but it was the necessary prefix to trigger
# T373374
!! test
T373374: Annotation with interwiki links
!! options
annotations=1
parsoid=wt2html
!! wikitext
[[wikipedia:Talk:Foo|Bar]][[mw:Extension:Foo|Bar]]
!! html/parsoid