# Force the test runner to ensure the extension is loaded
!! hooks
ref
references
!! endhooks

!! article
Template:echo
!! text
{{{1}}}
!! endarticle

!! article
Template:refinref
!! text
<ref>ho</ref>
!! endarticle

!! test
Simple <ref>, no <references/>
!! wikitext
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
!! html
Wikipedia rocks![1]

- ↑ Proceeds of Rockology, vol. XXI

!! end

!! test
Simple <ref>, with <references/>
!! wikitext
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>

<references/>
!! html

Wikipedia rocks![1]

- ↑ Proceeds of Rockology, vol. XXI

!! end

!! article
Template:Simple template
!! text
A ''simple'' template.
!! endarticle

!! test
<ref> with a simple template
!! wikitext
Templating<ref>{{simple template}}</ref>

<references/>
!! html

Templating[1]

- ↑ A simple template.

!! end

!! test
<ref> with a <nowiki>
!! wikitext
Templating<ref><nowiki>{{simple template}}</nowiki></ref>

<references/>
!! html

Templating[1]

- ↑ {{simple template}}

!! end

!! test
<ref> in a <nowiki>
!! wikitext
Templating<nowiki><ref>{{simple template}}</ref></nowiki>

<references/>
!! html

Templating<ref>{{simple template}}</ref>

!! end

!! test
<ref> in a 
!! wikitext
Templating

<references/>
!! html

Templating

!! end

!! test
 in a <ref> (bug 5384)
!! wikitext
Templating<ref>Text</ref>

<references/>
!! html

Templating[1]

- ↑ Text

!! end

!! test
<references> after <gallery> (bug 6164)
!! wikitext
<ref>one</ref>

<gallery>Image:Foobar.jpg</gallery>

<references/>
!! html

[1]

- 

- ↑ one

!! end

!! test
{{REVISIONID}} on page with <ref> (bug 6299)
!! wikitext
{{REVISIONID}}<ref>elite</ref>
!! html
1337[1]

- ↑ elite

!! end

!! test
{{REVISIONID}} on page without <ref> (bug 6299 sanity check)
!! wikitext
{{REVISIONID}}
!! html

1337

!! end

!! test
Ref with content followed by blank ref
!! wikitext
<ref name="blank">content</ref>

<ref name="blank"/>

<references/>
!! html

[1]

[1]

- ↑ 1.0 1.1 content

!! end

!! test
Blank ref followed by ref with content
!! wikitext
<ref name="blank"/>

<ref name="blank">content</ref>

<references/>
!! html

[1]

[1]

- ↑ 1.0 1.1 content

!! end

!! test
Regression: non-blank ref "0" followed by ref with content
!! wikitext
<ref name="blank">0</ref>

<ref name="blank">content</ref>

<references/>
!! html

[1]

[1]

- ↑ 1.0 1.1 0 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content

!! end

!! test
Regression sanity check: non-blank ref "1" followed by ref with content
!! wikitext
<ref name="blank">1</ref>

<ref name="blank">content</ref>

<references/>
!! html

[1]

[1]

- ↑ 1.0 1.1 1 Cite error: Invalid <ref> tag; name "blank" defined multiple times with different content

!! end

!! test
Ref names containing a number
!! wikitext
<ref name="test123test">One</ref>
<ref name="123test">Two</ref>
<ref name="test123">Three</ref>

<references />
!! html

[1]
[2]
[3]

- ↑ One

- ↑ Two

- ↑ Three

!! end

!! test
Erroneous refs
!! wikitext
<ref name="0">Zero</ref>

<ref>Also zero, but differently! (Normal ref)</ref>

<ref />

<ref name="foo" name="bar" />

<ref name="blankwithnoreference" />

<references name="quasit" />

<references />
!! html

Cite error: Invalid <ref> tag;
name cannot be a simple integer. Use a descriptive title

[1]

Cite error: The opening <ref> tag is malformed or has a bad name

[2]

[3]

Cite error: Invalid parameter in <references> tag

- ↑ Also zero, but differently! (Normal ref)

- ↑ Cite error: Invalid <ref> tag;
no text was provided for refs named bar
- ↑ Cite error: Invalid <ref> tag;
no text was provided for refs named blankwithnoreference

!! end

!! test
Simple <ref>, with <references/> in group
!! wikitext
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
Wikipedia rocks!<ref group=note>Proceeds of Rockology, vol. XXI</ref>

<references/>
<references group=note/>
!! html

Wikipedia rocks![1]
Wikipedia rocks![note 1]

- ↑ Proceeds of Rockology, vol. XXI

- ↑ Proceeds of Rockology, vol. XXI

!! end

!! test
Simple <ref>, with <references/> in group, with groupname in Chinese
!! wikitext
AAA<ref group="参">ref a</ref>BBB<ref group="注">note b</ref>CCC<ref group="参">ref c</ref>

;refs
<references group="参" />
;notes
<references group="注" />
!! html

AAA[参 1]BBB[注 1]CCC[参 2]

refs

- ↑ ref a

- ↑ ref c

notes

- ↑ note b

!! end

!! test
<ref> defined in <references>
!! wikitext
<ref name="foo"/>

<references>
<ref name="foo">BAR</ref>
</references>
!! html

[1]

- ↑ BAR

!! end

!! test
<ref> defined in <references> called with #tag
!! wikitext
<ref name="foo"/>

{{#tag:references|
<ref name="foo">BAR</ref>
}}
!! html

[1]

- ↑ BAR

!! end

!! test
<ref> defined in <references> error conditions
!! wikitext
<ref name="foo" group="2"/>

<references group="2">
<ref name="foo"/>
<ref name="unused">BAR</ref>
<ref name="foo" group="1">bad group</ref>
<ref>BAR BAR</ref>
</references>
!! html

[2 1]

- ↑ Cite error: Invalid <ref> tag;
no text was provided for refs named foo

Cite error: <ref> tag with name "unused" defined in <references> is not used in prior text.
Cite error: <ref> tag in <references> has conflicting group attribute "1".
Cite error: <ref> tag defined in <references> has no name attribute.

!! end

!! article
MediaWiki:cite_link_label_group-klingon
!! text
wa' cha' wej loS vagh jav Soch chorgh Hut wa'maH
!! endarticle

!! test
<ref> with custom group link with number names in Klingon
!! wikitext
Wikipedia rocks!<ref group="klingon">Proceeds of Rockology, vol. XXI</ref>

<references group="klingon"/>
!! html

Wikipedia rocks![wa']

- ↑ Proceeds of Rockology, vol. XXI

!! end

!! test
Bug 31374 regression check: nested strip items
!! wikitext
{{#tag:ref|note<ref>reference</ref>|group=Note}}
<references group=Note />
<references />
!! html

[Note 1]

- ↑ note[1]

- ↑ reference

!! end

!! test
Bug 13073 regression check: wrapped <references>
!! options
parsoid={"suppressErrors": true}
!! wikitext
<ref>
foo
</ref>

<references />
!! html/*

[1]

- ↑ 
foo

!! end

!! test
<ref> with no name and no content.
!! wikitext
Bla.<ref></ref>
!! html

Bla.Cite error: Invalid <ref> tag;
refs with no name must have content

!! end

!! test
<ref> with an empty-string name parameter and no content.
!! wikitext
Bla.<ref name=""></ref>
!! html

Bla.Cite error: Invalid <ref> tag;
refs with no name must have content

!! end

!! test
<ref> with a non-empty name parameter and no content.
!! wikitext
Bla.<ref name="void"></ref>
!! html
Bla.[1]

- ↑ Cite error: Invalid <ref> tag;
no text was provided for refs named void

!! end

!! test
<ref>s with the follow parameter
!! wikitext
Page one.<ref name="beginning">First page footnote text.</ref>

Page two.<ref follow="beginning">Second page footnote text.</ref>

== References ==
<references />
!! html

Page one.[1]

Page two.

References[edit]

- ↑ First page footnote text. Second page footnote text.

!! end

!! test
<ref> with both name and follow parameters - invalid
!! wikitext
Page one.<ref name="the-name" follow="the-name">This ref is invalid.</ref>
<references />
!! html

Page one.Cite error: Invalid <ref> tag;
invalid names, e.g. too many

!! end

!! test
Multiple definition (outside <references/>)
!! wikitext
<ref name=a>abc</ref>
<ref name=a>def</ref>
<references />
!! html

[1]
[1]

- ↑ 1.0 1.1 abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

!! test
Multiple definition (inside <references/>)
!! wikitext
<ref name=a />
<references>
<ref name=a>abc</ref>
<ref name=a>def</ref>
</references>
!! html

[1]

- ↑ abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

!! test
Multiple definition (mixed outside/inside)
!! wikitext
<ref name=a>abc</ref>
<references>
<ref name=a>def</ref>
</references>
!! html

[1]

- ↑ abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

!! test
Multiple definition (inside {{#tag:references}})
!! wikitext
<ref name=a />
{{#tag:references|
<ref name=a>abc</ref>
<ref name=a>def</ref>
}}
!! html

[1]

- ↑ abc Cite error: Invalid <ref> tag; name "a" defined multiple times with different content

!! end

# Parsoid doesn't rt cleanly because name attribute is actually broken
# here (<ref> tag closes at first >); see next test for a tidied version.
!! test
T29694 - [] in reference names in HTML5 fragment mode
!! config
wgFragmentMode=[ 'html5' ]
!! options
parsoid=wt2html
!! wikitext
<ref name="[#foo] {bar} <baz>">[bar]</ref>
!! html/php
[1]

- ↑ ">[bar]

!! html/parsoid

[1]

- ↑  ">[bar]
!! end

!! test
T29694 - [] in reference names in HTML5 fragment mode (tidied)
!! config
wgFragmentMode=[ 'html5' ]
!! wikitext
<ref name="[#foo] {bar} <baz>">[bar]</ref>
<references />
!! html/php

[1]

- ↑ [bar]

!! html/parsoid

_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_<baz>-1"},"attrs":{"name":"[#foo] {bar} <baz>"}}'>-1" style="counter-reset: mw-Ref 1;">[1]

- -1" id="cite_note-[#foo]_{bar}_<baz>-1">_1-0" rel="mw:referencedBy">↑  -1" class="mw-reference-text" data-parsoid="{}">[bar]
!! end

#### ----------------------------------------------------------------
#### Parsoid-only testing of Parsoid's impl of <ref> and <references>
#### tags. Parsoid's output for these tags differs from that of the
#### PHP parser.
#### ----------------------------------------------------------------

!! test
Ref: 1. ref-location should be replaced with an index span
!! wikitext
A <ref>foo</ref>
B <ref name="x">foo</ref>
C <ref name="y" />
<references />
!! html/parsoid

A [1]
B [2]
C [3]

- ↑  foo
- ↑  foo
- ↑  

!! end

!! test
Ref: 2. ref-tags with identical names should all get the same index
!! wikitext
A <ref name="x">foo</ref>
B <ref name="x" />
<references />
!! html/parsoid

A [1]
B [1]

- 1 2  foo

!! end

!! test
Ref: 3. spaces in ref-names should be ignored
!! wikitext
A <ref name="x">foo</ref>
B <ref name=" x " />
C <ref name= x  />
<references />
!! html/parsoid

A [1]
B [1]
C [1]</supn>

- 1 2 3  foo

!! 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
!! wikitext
A <ref name="constructor">foo</ref>
<references />
!! html/parsoid

A [1]

- ↑  foo

!! end

!! test
Ref: 5. body should accept generic wikitext
!! wikitext
A <ref>
 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
</ref>

<references />
!! html/parsoid

A [1]

- ↑  This is a bolded link and this is a transclusion

!! end

!! test
Ref: 6. indent-pres should not be output in ref-body
!! wikitext
A <ref>
 foo
 bar
 baz
</ref>

<references />
!! html/parsoid

A [1]

- ↑  foo
 bar
 baz

!! end

!! test
Ref: 7. No p-wrapping in ref-body
!! wikitext
A <ref>
foo

bar

baz

booz
</ref>

<references />
!! html/parsoid

A [1]

- ↑  foo

bar

baz

booz

!! end

!! test
Ref: 8. transclusion wikitext has lower precedence
!! wikitext
A <ref> foo {{echo|</ref> B C}}

<references />
!! html/parsoid

A [1] B C}}

- ↑  foo {{echo|

!! end

!! test
Ref: 9. unclosed comments should not leak out of ref-body
!! wikitext
A <ref> foo 

!! end

!! test
Ref: 10. Unclosed HTML tags should not leak out of ref-body
!! wikitext
A <ref>  foo </ref> B C

<references />
!! html/parsoid

A [1] B C

- ↑   foo 

!! end

!! test
Ref: 11. ref-tags acts like an inline element wrt P-wrapping
!! wikitext
A <ref>foo</ref> B
C <ref>bar</ref> D
<references />
!! html/parsoid

A [1] B
C [2] D

- ↑  foo
- ↑  bar

!! end

!! test
Ref: 12. ref-tags act as trailing newline migration barrier
!! wikitext
a

b <ref />
<ref />

c
<references />
!! html/parsoid

a

b [1]
[2]

c

- ↑  
- ↑  
!! end

!! test
Ref: 13. ref-tags are not SOL-transparent and block indent-pres
!! wikitext
<ref>foo</ref> A
<ref>bar
</ref> B
<references />
!! html/parsoid

[1] A
[2] B

- ↑  foo
- ↑  bar

!! end

## Roundtripping fails because of nowiki'ing
!! test
Ref: 14. A nested ref-tag should be emitted as plain text
!! options
parsoid=wt2html
!! wikitext
<ref>foo <ref>bar</ref> baz</ref>

<references />
!! html/parsoid

[1] baz</ref>

- ↑  foo <ref>bar
!! end

!! test
Ref: 15. ref-tags with identical names should get identical indexes
!! wikitext
A1 <ref name="a">foo</ref> A2 <ref name="a" />
B1 <ref name="b" /> B2 <ref name="b">bar</ref>

<references />
!! html/parsoid

A1 [1] A2 [1]
B1 [2] B2 [2]

- 1 2  foo
- 1 2  bar

!! end

## We don't bother wt2wt-ing non-standard whitespace
!! test
Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
!!options
parsoid=wt2html
!! wikitext
A <ref >foo</ref >

<references />
!! html/parsoid

A [1]

- ↑  foo
!! end

!! test
Ref: 17. Generate valid HTML5 id/about attributes
!! wikitext
<ref name="a b">foo</ref>
<ref name=":0">ve-created name</ref>

<references />
!! html/parsoid

[1]
[2]

- ↑  foo
- ↑  ve-created name

!! end

!! test
Ref: 18. T58916: Extension attributes should be parsed as plain text
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! wikitext
<ref name="{{echo|a}}">foo</ref>

<references />
!! html/php

[1]

- ↑ foo

!! html/parsoid

[1]

- ↑  foo

!! end

# Parsoid doesn't wt2wt this cleanly because we serialize both
# versions of the name the same way ("a & b")
!! test
Ref: 19. ref-tags with identical name encodings should get identical indexes
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! options
parsoid=wt2html,html2html
!! wikitext
1 <ref name="a & b">foo</ref> 2 <ref name="a & b" />

<references />
!! html/php

1 [1] 2 [1]

- ↑ 1.0 1.1 foo

!! html/parsoid

1 [1] 2 [1]

- 1 2  foo

!! end

!! test
Ref: 20. ref-tags with identical names but different content should keep it
!! wikitext
A <ref name="foo">Foo one</ref>
B <ref name="foo">Foo two</ref>
C <ref name="foo" />

<references />
!! html/parsoid

A [1]
B [1]
C [1]

- 1 2 3  Foo one

!! end

!! test
References: 1. references tag without any refs should be handled properly
!! wikitext
<references />
!! html/parsoid

!! end

!! test
References: 2. references tag with group only outputs references from that group
!! 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/parsoid

A [a 1]
B [b 1]
C [1]

- ↑  foo

- ↑  baz

- ↑  bar

!! end

!! test
References: 3. ref list should be cleared after processing references
!! wikitext
A <ref>foo</ref>

<references />

B <ref>bar</ref>

<references />
!! html/parsoid

A [1]

- ↑  foo

B [1]

- ↑  bar

!! end

!! test
References: 4. only referenced group should be cleared after processing references
!! wikitext
A <ref group="a">afoo</ref>
B <ref>bfoo</ref>

<references group="a" />

C <ref>cfoo</ref>

<references />
!! html/parsoid

A [a 1]
B [1]

- ↑  afoo

C [2]

- ↑  bfoo
- ↑  cfoo

!! end

## Don't expect this to rt since we're dropping content
!! test
References: 5. ref tags in references should be processed while ignoring all other content
!! options
parsoid=wt2html,html2html
!! wikitext
A <ref name="a" />
B <ref name="b">bar</ref>

<references>
<ref name="a">foo</ref>
This should just get lost.
</references>
!! html/parsoid

A [1]
B [2]

<a href=\"./Main_Page#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'>
- ↑  foo
- ↑  bar

!! end

!! test
References: 6. <references /> from a transclusion
!! wikitext
<ref>Foo</ref> {{echo|<references />}}
!! html/parsoid

[1]
 
"}},"i":0}}]}'>
- ↑  Foo

!! end

!! test
References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
!! wikitext
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />

<references />

<references group="X">
<ref name="b">foo</ref>
</references>
!! html/parsoid

A [1]
B [X 1]

- ↑  foo bar for a

<a href=\"./Main_Page#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]</span></a></sup>\n"}}'>
- ↑  foo

!! end

!! test
References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
!! wikitext
X{{echo|<ref>foo {{echo|bar}} and {{echo|baz}} boo</ref>}}
<references />
!! html/parsoid

Xfoo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>"}},"i":0}}]}'>[1]

- ↑  foo bar and baz boo

!! end

!! test
References: 9. Generate missing references list at the end
!! wikitext
A <ref>foo</ref>
B <ref group="inexistent">bar</ref>
!! html/parsoid

A [1] B [inexistent 1]

- ↑  foo

- ↑  bar

!! end

!! test
References: 10.1. New <references/> shouldn't be added for unrelated edits.
!! options
parsoid={
  "modes": ["selser"],
  "changes": [["#x", "remove"]],
  "selser": "noauto"
}
!! wikitext
Unrelated text that's going to disappear.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end

!! test
References: 10.2. New <references/> shouldn't be added for unrelated edits.
!! options
parsoid={
  "modes": ["selser"],
  "changes": [["#x", "remove"]],
  "selser": "noauto",
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Unrelated text that's going to disappear.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end

# Doesn't wt2wt cleanly because we don't encode the & in html2wt direction
!! test
Entities in ref name
!! config
wgFragmentMode=[ 'html5', 'legacy' ]
!! options
parsoid=wt2html,html2html
!! wikitext
<ref name="test & me {{echo|foo}}">hi</ref>
<references />
!! html/php

[1]

- ↑ hi

!! html/parsoid

[1]

- ↑  hi

!! end

## The output here may look funny, but it's what the php parser will do.  The
## unclosed references tag becomes escaped text, and then a new references
## tag is auto-generated.  The test is wt2html only because it roundtrips with
## nowiki tags, and the auto-generated references tag is only dropped in
## rtTestMode.
!! test
Generate references for unclosed references tag
!! options
parsoid=wt2html
!! wikitext
a<ref>foo</ref>

<references>
!! html/parsoid

a[1]

<references>

- ↑  foo
!! end

!! test
New reference serializes on its own line
!! options
parsoid=wt2wt,html2wt
!! wikitext
foo
<references />
!! html/parsoid
foo

!! end

!! test
Ref in ref
!! wikitext
test <ref>hi {{refinref}}</ref>
<references />
!! html/php

test [1]

- ↑ hi 

Cite error: <ref> tag defined in <references> has no name attribute.

!! html/parsoid

test [1]

- ↑  hi 
!! end

## Parsoid responsive references tests

!! test
Responsive references: disabled, autogenerated
!! options
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2
!! end

!! test
Responsive references: enabled, autogenerated
!! options
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: enabled, autogenerated, exceed
!! options
parsoid={
  "modes": ["wt2html"],
  "responsiveReferences": { "enabled": true, "threshold": 1 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: disabled
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2
!! end

!! test
Responsive references: enabled
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: enabled, exceed
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 1 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: disabled, explicit
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: disabled, explicit, exceed
!! options
parsoid={
  "responsiveReferences": { "enabled": false, "threshold": 1 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2

!! end

!! test
Responsive references: enabled, explicit off
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="0" />
!! html/parsoid

Test [1][2]

- ↑  1
- ↑  2
!! end

!! test
Responsive references: roundtrip templates
!! options
parsoid={
  "responsiveReferences": { "enabled": true, "threshold": 2 }
}
!! wikitext
test <ref>123</ref>

{{echo|haha<references/>}}
!! html/parsoid

test [1]

"}},"i":0}}]}'>haha

- ↑  123

!! end

## End Parsoid responsive references tests

!! article
Template:CircularRef
!! text
<ref>Hi {{CircularRef}}</ref>
!! endarticle

!! test
CircularRef
!! wikitext
<ref>Hi {{CircularRef}}</ref>
<references />
!! html/php

[1]

- ↑ Hi 

Cite error: <ref> tag defined in <references> has no name attribute.

!! html/parsoid

[1]

- ↑  Hi 
!! end
