2022-10-03 23:40:46 +00:00
!! options
version=2
2024-01-25 04:52:39 +00:00
parsoid-compatible=wt2html,wt2wt,html2wt,html2html,selser
2022-10-03 23:40:46 +00:00
!! end
2022-05-11 23:08:15 +00:00
2023-03-10 18:15:58 +00:00
# NOTE about Parsoid HTML for cite tests with follows.
# Parsoid HTML has <sup>s for follows because it needs to be able to roundtrip it back.
2024-01-21 14:38:12 +00:00
# This output is hidden from read views via CSS in ext.cite.parsoid.styles.less.
2023-03-10 18:15:58 +00:00
2006-06-01 05:58:52 +00:00
# Force the test runner to ensure the extension is loaded
!! hooks
ref
references
!! endhooks
2017-02-22 17:21:47 +00:00
!! article
2020-05-07 17:11:52 +00:00
Template:1x
2017-02-22 17:21:47 +00:00
!! text
{{{1}}}
!! endarticle
2017-11-21 22:25:25 +00:00
!! article
Template:refinref
!! text
2021-07-30 15:03:25 +00:00
<ref>{{{1}}}</ref>
2017-11-21 22:25:25 +00:00
!! endarticle
2023-02-09 21:58:10 +00:00
!! article
Bolded link
!! text
foo
!! endarticle
!! article
Foo
!! text
foo
!! endarticle
2020-07-15 15:39:36 +00:00
## Parsoid only drops autoGenerated references lists in rt testing
2006-06-01 05:58:52 +00:00
!! test
Simple <ref>, no <references/>
2020-07-15 15:39:36 +00:00
!! options
parsoid=wt2html
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
2020-07-15 15:39:36 +00:00
!! html/php
2020-04-01 22:13:31 +00:00
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2014-06-23 21:42:17 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Wikipedia rocks!<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Proceeds of Rockology, vol. XXI</span></li></ol></div>
2006-06-01 05:58:52 +00:00
!! end
2020-04-01 22:13:31 +00:00
!! test
Simple <ref>, no <references/>, page ends in a list
2020-07-15 15:39:36 +00:00
!! options
parsoid=wt2html
2020-04-01 22:13:31 +00:00
!! wikitext
blah<ref>foo</ref> --Matma Rex 17:35, 31 March 2020 (UTC)
* bleh --Matma Rex 17:35, 31 March 2020 (UTC)
!! html
<p>blah<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup> --Matma Rex 17:35, 31 March 2020 (UTC)
</p>
<ul><li>bleh --Matma Rex 17:35, 31 March 2020 (UTC)</li></ul>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2022-05-11 23:08:15 +00:00
<p>blah<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> --Matma Rex 17:35, 31 March 2020 (UTC)</p>
2020-07-15 15:39:36 +00:00
<ul><li>bleh --Matma Rex 17:35, 31 March 2020 (UTC)</li></ul>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2020-04-01 22:13:31 +00:00
!! end
2006-06-01 05:58:52 +00:00
!! test
Simple <ref>, with <references/>
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2006-06-01 05:58:52 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Wikipedia rocks!<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Proceeds of Rockology, vol. XXI</span></li></ol></div>
2006-06-01 05:58:52 +00:00
!! end
!! article
Template:Simple template
!! text
A ''simple'' template.
!! endarticle
!! test
<ref> with a simple template
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Templating<ref>{{simple template}}</ref>
2020-07-15 15:39:36 +00:00
<references />
!! html/php
2016-03-16 20:29:32 +00:00
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2006-06-01 05:58:52 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">A <i>simple</i> template.</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Templating<sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"simple template","href":"./Template:Simple_template"},"params":{},"i":0}}]}'>A </span><i about="#mwt2">simple</i><span about="#mwt2"> template.</span></span></li></ol></div>
2006-06-01 05:58:52 +00:00
!! end
!! test
<ref> with a <nowiki>
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Templating<ref><nowiki>{{simple template}}</nowiki></ref>
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2006-06-01 05:58:52 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">{{simple template}}</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Templating<sup about="#mwt5" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">{{simple template}}</span></li></ol></div>
2006-06-01 05:58:52 +00:00
!! end
!! test
<ref> in a <nowiki>
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Templating<nowiki><ref>{{simple template}}</ref></nowiki>
2019-01-02 17:31:42 +00:00
<references />
2017-02-22 17:21:47 +00:00
!! html
2006-06-01 05:58:52 +00:00
<p>Templating<ref>{{simple template}}</ref>
2007-05-09 14:48:05 +00:00
</p><p><br />
2006-06-01 05:58:52 +00:00
</p>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>Templating<span typeof="mw:Nowiki"><ref>{{simple template}}</ref></span></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div>
2006-06-01 05:58:52 +00:00
!! end
!! test
<ref> in a <!--comment-->
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Templating<!--<ref>{{simple template}}</ref>-->
2019-01-02 17:31:42 +00:00
<references />
2017-02-22 17:21:47 +00:00
!! html
2006-06-01 05:58:52 +00:00
<p>Templating
2007-05-09 14:48:05 +00:00
</p><p><br />
2006-06-01 05:58:52 +00:00
</p>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>Templating</p><!--<ref>{{simple template}}</ref>-->
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div>
2006-06-01 05:58:52 +00:00
!! end
!! test
2019-11-22 18:38:40 +00:00
<!--comment--> in a <ref> (T7384)
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 05:58:52 +00:00
Templating<ref>Text<!--comment--></ref>
2019-01-02 17:31:42 +00:00
<references />
2021-09-30 20:00:56 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2006-06-01 05:58:52 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Text</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2019-11-22 18:38:40 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Templating<sup about="#mwt6" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2019-11-22 18:38:40 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Text<!--comment--></span></li></ol></div>
2019-11-22 18:38:40 +00:00
!! end
!! test
<ref> in an ignored caption (T235656)
2023-02-09 21:58:10 +00:00
!! config
wgParserEnableLegacyMediaDOM=false
2019-11-22 18:38:40 +00:00
!! wikitext
[[File:Foobar.jpg|frameless|ignored caption with a ref<ref>boo</ref>]]
<references />
2021-09-30 20:00:56 +00:00
!! html/php
2023-04-20 20:01:06 +00:00
<p><span class="mw-default-size" typeof="mw:File/Frameless"><a href="/wiki/File:Foobar.jpg" class="mw-file-description" title="ignored caption with a ref[1]"><img alt="ignored caption with a ref[1]" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="mw-file-element" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a></span>
2019-11-22 18:38:40 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">boo</span>
</li>
</ol></div>
2023-05-12 13:59:44 +00:00
!! html/parsoid
<p><span class="mw-default-size" typeof="mw:File/Frameless" data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"caption","ak":"ignored caption with a ref<ref>boo</ref>"}]}' data-mw='{"caption":"ignored caption with a ref<sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[54,68,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"}'><a href="./File:Foobar.jpg" class="mw-file-description" title="ignored caption with a ref"><img alt="ignored caption with a ref" resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" class="mw-file-element"/></a></span></p>
2019-11-22 18:38:40 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">boo</span></li></ol></div>
2019-11-22 18:38:40 +00:00
!! end
!! test
<ref> in expanded attributes of tags (legitimate or otherwise)
!! options
parsoid=wt2html,wt2wt
!! wikitext
{|
|- <ref>boo</ref>
|x
|}
<references />
2021-09-30 20:00:56 +00:00
!! html/php
2019-11-22 18:38:40 +00:00
<table>
<tbody><tr id="cite_ref-1" class="reference">
<td>x
</td></tr></tbody></table>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">boo</span>
</li>
</ol></div>
!! html/parsoid
<table>
2021-07-30 15:03:25 +00:00
<tbody><tr about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"startTagSrc":"|-","a":{"<ref>boo</ref>":null},"sa":{"<ref>boo</ref>":""}}' data-mw='{"attribs":[[{"txt":"","html":"<sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[6,20,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"},{"html":""}]]}'>
2019-11-22 18:38:40 +00:00
<td>x</td></tr>
</tbody></table>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">boo</span></li></ol></div>
2019-11-22 18:38:40 +00:00
!! end
!! test
<ref>s in language variant markup
!! options
2023-12-07 18:34:33 +00:00
language=sr htmlVariantLanguage=sr-Cyrl
2019-11-22 18:38:40 +00:00
!! wikitext
-{lj <ref>a</ref>}-а б -{nj <ref name="y">b</ref>}-вг-{dž}- c <ref name="y" />
<references />
2021-09-30 20:00:56 +00:00
!! html/php
2019-11-22 18:38:40 +00:00
<p>lj <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>а б nj <sup id="cite_ref-y_2-0" class="reference"><a href="#cite_note-y-2">[2]</a></sup>вг dž ц <sup id="cite_ref-y_2-1" class="reference"><a href="#cite_note-y-2">[2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">а </span>
</li>
<li id="cite_note-y-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-y_2-0">2,0</a></sup> <sup><a href="#cite_ref-y_2-1">2,1</a></sup></span> <span class="reference-text">б </span>
</li>
</ol></div>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"lj <sup about=\"#mwt7\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[5,17,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"}}'></span>а б <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nj <sup about=\"#mwt8\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[28,49,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"y\"},\"body\":{\"id\":\"mw-reference-text-cite_note-y-2\"}}'><a href=\"./Parser_test#cite_note-y-2\" style=\"counter-reset: mw-Ref 2;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[2]</span></a></sup>"}}'></span>вг<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"dž"}}'></span> c <sup about="#mwt6" class="mw-ref reference" id="cite_ref-y_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="./Parser_test#cite_note-y-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">a</span></li><li about="#cite_note-y-2" id="cite_note-y-2"><a href="./Parser_test#cite_ref-y_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-2" class="mw-reference-text">b</span></li></ol></div>
2006-06-01 05:58:52 +00:00
!! end
2006-06-01 21:11:29 +00:00
!! test
<references> after <gallery> (bug 6164)
2019-03-19 15:39:23 +00:00
!! options
parsoid=wt2html,html2html
2023-02-09 21:58:10 +00:00
!! config
wgParserEnableLegacyMediaDOM=false
2017-02-22 17:21:47 +00:00
!! wikitext
2006-06-01 21:11:29 +00:00
<ref>one</ref>
<gallery>Image:Foobar.jpg</gallery>
2019-01-02 17:31:42 +00:00
<references />
2019-03-19 15:39:23 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2006-06-01 21:11:29 +00:00
</p>
2013-08-17 10:22:45 +00:00
<ul class="gallery mw-gallery-traditional">
2023-02-09 21:58:10 +00:00
<li class="gallerybox" style="width: 155px">
2023-04-20 20:01:06 +00:00
<div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:File"><a href="/wiki/File:Foobar.jpg" class="mw-file-description"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" width="120" height="14" class="mw-file-element" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></span></div>
2023-11-28 00:05:00 +00:00
<div class="gallerytext"></div>
2023-02-09 21:58:10 +00:00
</li>
2010-11-29 00:11:19 +00:00
</ul>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">one</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2023-05-12 13:59:44 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2019-03-19 15:39:23 +00:00
<ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
2023-05-12 13:59:44 +00:00
<li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span typeof="mw:File"><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" class="mw-file-element"/></a></span></div><div class="gallerytext"></div></li>
2019-03-19 15:39:23 +00:00
</ul>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">one</span></li></ol></div>
2006-06-01 21:11:29 +00:00
!! end
2006-07-10 17:59:37 +00:00
!! test
{{REVISIONID}} on page with <ref> (bug 6299)
2017-02-22 17:21:47 +00:00
!! wikitext
2006-07-10 17:59:37 +00:00
{{REVISIONID}}<ref>elite</ref>
2017-02-22 17:21:47 +00:00
!! html
2020-04-01 22:13:31 +00:00
<p>1337<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2014-06-23 21:42:17 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">elite</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"REVISIONID","function":"revisionid"},"params":{},"i":0}}]}'>1337</span><sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">elite</span></li></ol></div>
2006-07-10 17:59:37 +00:00
!! end
!! test
{{REVISIONID}} on page without <ref> (bug 6299 sanity check)
2017-02-22 17:21:47 +00:00
!! wikitext
2006-07-10 17:59:37 +00:00
{{REVISIONID}}
2017-02-22 17:21:47 +00:00
!! html
2006-07-10 17:59:37 +00:00
<p>1337
</p>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"REVISIONID","function":"revisionid"},"params":{},"i":0}}]}'>1337</span></p>
2006-07-10 17:59:37 +00:00
!! end
2006-11-03 15:34:46 +00:00
2015-09-30 13:38:42 +00:00
!! test
Ref with content followed by blank ref
2017-02-22 17:21:47 +00:00
!! wikitext
2015-09-30 13:38:42 +00:00
<ref name="blank">content</ref>
2019-01-02 17:31:42 +00:00
<ref name="blank" />
2015-09-30 13:38:42 +00:00
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
2015-09-30 13:38:42 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-09-30 13:38:42 +00:00
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">content</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-blank_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"id":"mw-reference-text-cite_note-blank-1"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-blank_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-blank-1" id="cite_note-blank-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-blank_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-blank_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-blank-1" class="mw-reference-text">content</span></li></ol></div>
2015-09-30 13:38:42 +00:00
!! end
2006-11-03 15:34:46 +00:00
!! test
Blank ref followed by ref with content
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="blank" />
2006-11-03 15:34:46 +00:00
<ref name="blank">content</ref>
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
2006-11-03 15:34:46 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">content</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-blank_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-blank_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"id":"mw-reference-text-cite_note-blank-1"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-blank-1" id="cite_note-blank-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-blank_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-blank_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-blank-1" class="mw-reference-text">content</span></li></ol></div>
2006-11-03 15:34:46 +00:00
!! end
!! test
Regression: non-blank ref "0" followed by ref with content
2017-02-22 17:21:47 +00:00
!! wikitext
2006-11-03 15:34:46 +00:00
<ref name="blank">0</ref>
<ref name="blank">content</ref>
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
2006-11-03 15:34:46 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">0 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "blank" defined multiple times with different content</span></span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-blank_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"id":"mw-reference-text-cite_note-blank-1"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-blank_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"html":"content"},"errors":[{"key":"cite_error_references_duplicate_key","params":["blank"]}]}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-blank-1" id="cite_note-blank-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-blank_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-blank_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-blank-1" class="mw-reference-text">0</span></li></ol></div>
2006-11-03 15:34:46 +00:00
!! end
!! test
Regression sanity check: non-blank ref "1" followed by ref with content
2017-02-22 17:21:47 +00:00
!! wikitext
2006-11-03 15:34:46 +00:00
<ref name="blank">1</ref>
<ref name="blank">content</ref>
2019-01-02 17:31:42 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
</p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
2006-11-03 15:34:46 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">1 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "blank" defined multiple times with different content</span></span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-blank_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"id":"mw-reference-text-cite_note-blank-1"}}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-blank_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"blank"},"body":{"html":"content"},"errors":[{"key":"cite_error_references_duplicate_key","params":["blank"]}]}'><a href="./Parser_test#cite_note-blank-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2020-07-15 15:39:36 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-blank-1" id="cite_note-blank-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-blank_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-blank_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-blank-1" class="mw-reference-text">1</span></li></ol></div>
2006-11-03 15:34:46 +00:00
!! end
2007-12-16 18:49:10 +00:00
2007-12-27 22:25:15 +00:00
!! test
Ref names containing a number
2017-02-22 17:21:47 +00:00
!! wikitext
2007-12-27 22:25:15 +00:00
<ref name="test123test">One</ref>
<ref name="123test">Two</ref>
<ref name="test123">Three</ref>
<references />
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-test123test_1-0" class="reference"><a href="#cite_note-test123test-1">[1]</a></sup>
<sup id="cite_ref-123test_2-0" class="reference"><a href="#cite_note-123test-2">[2]</a></sup>
<sup id="cite_ref-test123_3-0" class="reference"><a href="#cite_note-test123-3">[3]</a></sup>
2007-12-27 22:25:15 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-test123test-1"><span class="mw-cite-backlink"><a href="#cite_ref-test123test_1-0">↑</a></span> <span class="reference-text">One</span>
2011-11-14 12:20:24 +00:00
</li>
2012-10-17 22:58:55 +00:00
<li id="cite_note-123test-2"><span class="mw-cite-backlink"><a href="#cite_ref-123test_2-0">↑</a></span> <span class="reference-text">Two</span>
2011-11-14 12:20:24 +00:00
</li>
2012-10-17 22:58:55 +00:00
<li id="cite_note-test123-3"><span class="mw-cite-backlink"><a href="#cite_ref-test123_3-0">↑</a></span> <span class="reference-text">Three</span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-test123test_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test123test"},"body":{"id":"mw-reference-text-cite_note-test123test-1"}}'><a href="./Parser_test#cite_note-test123test-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-123test_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"123test"},"body":{"id":"mw-reference-text-cite_note-123test-2"}}'><a href="./Parser_test#cite_note-123test-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<sup about="#mwt9" class="mw-ref reference" id="cite_ref-test123_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test123"},"body":{"id":"mw-reference-text-cite_note-test123-3"}}'><a href="./Parser_test#cite_note-test123-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-test123test-1" id="cite_note-test123test-1"><a href="./Parser_test#cite_ref-test123test_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test123test-1" class="mw-reference-text">One</span></li><li about="#cite_note-123test-2" id="cite_note-123test-2"><a href="./Parser_test#cite_ref-123test_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-123test-2" class="mw-reference-text">Two</span></li><li about="#cite_note-test123-3" id="cite_note-test123-3"><a href="./Parser_test#cite_ref-test123_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test123-3" class="mw-reference-text">Three</span></li></ol></div>
2007-12-27 22:25:15 +00:00
!! end
2021-07-30 15:03:25 +00:00
## Note that the underscores are normalized in the id only and these remain
## separate names (T184912#4758775)
2018-11-19 17:07:55 +00:00
!! test
T184912: Consistent normalization of consecutive underscores
!! wikitext
2021-07-30 15:03:25 +00:00
<ref name="test_123">example</ref>
<ref name="test__123">example</ref>
2018-11-19 17:07:55 +00:00
<references />
2021-07-30 15:03:25 +00:00
!! html/php
<p><sup id="cite_ref-test_123_1-0" class="reference"><a href="#cite_note-test_123-1">[1]</a></sup>
<sup id="cite_ref-test_123_2-0" class="reference"><a href="#cite_note-test_123-2">[2]</a></sup>
2018-11-19 17:07:55 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2021-07-30 15:03:25 +00:00
<li id="cite_note-test_123-1"><span class="mw-cite-backlink"><a href="#cite_ref-test_123_1-0">↑</a></span> <span class="reference-text">example</span>
</li>
<li id="cite_note-test_123-2"><span class="mw-cite-backlink"><a href="#cite_ref-test_123_2-0">↑</a></span> <span class="reference-text">example</span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-test_123_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test_123"},"body":{"id":"mw-reference-text-cite_note-test_123-1"}}'><a href="./Parser_test#cite_note-test_123-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-test_123_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test__123"},"body":{"id":"mw-reference-text-cite_note-test_123-2"}}'><a href="./Parser_test#cite_note-test_123-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-test_123-1" id="cite_note-test_123-1"><a href="./Parser_test#cite_ref-test_123_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_123-1" class="mw-reference-text">example</span></li><li about="#cite_note-test_123-2" id="cite_note-test_123-2"><a href="./Parser_test#cite_ref-test_123_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_123-2" class="mw-reference-text">example</span></li></ol></div>
2007-12-27 22:25:15 +00:00
!! end
2007-12-16 18:49:10 +00:00
!! test
Erroneous refs
2017-02-22 17:21:47 +00:00
!! wikitext
2007-12-16 18:49:10 +00:00
<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 />
2021-07-30 15:03:25 +00:00
!! html/php
2020-01-23 11:56:25 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name cannot be a simple integer. Use a descriptive title</span>
2016-03-16 20:29:32 +00:00
</p><p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2015-10-08 20:38:01 +00:00
</p><p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code><ref></code> tag is malformed or has a bad name</span>
2016-03-16 20:29:32 +00:00
</p><p><sup id="cite_ref-bar_2-0" class="reference"><a href="#cite_note-bar-2">[2]</a></sup>
</p><p><sup id="cite_ref-blankwithnoreference_3-0" class="reference"><a href="#cite_note-blankwithnoreference-3">[3]</a></sup>
2017-03-22 19:05:27 +00:00
</p><p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><references></code> tag</span>
2007-12-16 18:49:10 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Also zero, but differently! (Normal ref)</span>
2011-11-14 12:20:24 +00:00
</li>
2020-01-23 11:56:25 +00:00
<li id="cite_note-bar-2"><span class="mw-cite-backlink"><a href="#cite_ref-bar_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>bar</code></span></li>
<li id="cite_note-blankwithnoreference-3"><span class="mw-cite-backlink"><a href="#cite_ref-blankwithnoreference_3-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>blankwithnoreference</code></span></li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-0_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"0"},"body":{"id":"mw-reference-text-cite_note-0-1"},"errors":[{"key":"cite_error_ref_numeric_key"}]}'><a href="./Parser_test#cite_note-0-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{},"errors":[{"key":"cite_error_ref_no_key"}]}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<p><sup about="#mwt8" class="mw-ref reference" id="cite_ref-bar_4-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"bar"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-bar-4" style="counter-reset: mw-Ref 4;"><span class="mw-reflink-text">[4]</span></a></sup></p>
<p><sup about="#mwt10" class="mw-ref reference" id="cite_ref-blankwithnoreference_5-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"blankwithnoreference"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-blankwithnoreference-5" style="counter-reset: mw-Ref 5;"><span class="mw-reflink-text">[5]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Error" data-mw='{"name":"references","attrs":{"name":"quasit"},"errors":[{"key":"cite_error_references_invalid_parameters"}]}'><ol class="mw-references references"><li about="#cite_note-0-1" id="cite_note-0-1"><a href="./Parser_test#cite_ref-0_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-0-1" class="mw-reference-text">Zero</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">Also zero, but differently! (Normal ref)</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"></span></li><li about="#cite_note-bar-4" id="cite_note-bar-4"><a href="./Parser_test#cite_ref-bar_4-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-bar-4" class="mw-reference-text"></span></li><li about="#cite_note-blankwithnoreference-5" id="cite_note-blankwithnoreference-5"><a href="./Parser_test#cite_ref-blankwithnoreference_5-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-blankwithnoreference-5" class="mw-reference-text"></span></li></ol></div>
2021-07-30 15:03:25 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt14" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div>
2007-12-16 18:49:10 +00:00
!! end
2018-12-10 11:28:29 +00:00
!! test
Can't have name="…" and follow="…" the same time
!! wikitext
<ref name="theName" follow="theFollows">theValue</ref>
<references />
2021-07-30 15:03:25 +00:00
!! html/php
2022-05-27 06:27:10 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: A <code><ref follow="…"></code> tag that is the continuation of a previous one can neither be named individually nor extended</span>
2018-12-10 11:28:29 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
2024-01-05 19:25:07 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"theName","follow":"theFollows"},"body":{"id":"mw-reference-text-cite_note-theName-1"},"errors":[{"key":"cite_error_ref_follow_conflicts"}]}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-theName-1" id="cite_note-theName-1"><a href="./Parser_test#cite_ref-theName_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> theValue</span></span></li></ol></div>
2018-12-10 11:28:29 +00:00
!! end
!! test
2023-12-05 19:59:50 +00:00
Conflicting name="…" and follow="…" together with another invalid parameter
2018-12-10 11:28:29 +00:00
!! wikitext
<ref name="theName" follow="theFollows" dummy="dummy">theValue</ref>
<references />
2021-07-30 15:03:25 +00:00
!! html/php
2023-12-05 19:59:50 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><ref></code> tag</span>
2018-12-10 11:28:29 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
2024-01-05 19:25:07 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"theName","follow":"theFollows","dummy":"dummy"},"body":{"id":"mw-reference-text-cite_note-theName-1"},"errors":[{"key":"cite_error_ref_follow_conflicts"}]}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-theName-1" id="cite_note-theName-1"><a href="./Parser_test#cite_ref-theName_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> theValue</span></span></li></ol></div>
2018-12-10 11:28:29 +00:00
!! end
2019-11-22 10:28:45 +00:00
!! test
It's not possible to follow="…" a <ref> defined in the <references> section
!! wikitext
<ref follow="theName">theFollows</ref>
<references>
<ref name="theName">theValue</ref>
</references>
2021-07-30 15:03:25 +00:00
!! html/php
2020-02-05 10:41:21 +00:00
<div class="mw-references-wrap"><ol class="references">
<p id="cite_note-theName"><span class="reference-text">theFollows</span>
</p>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "theName" defined in <code><references></code> is not used in prior text.</span>
2019-11-22 10:28:45 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-1"},"errors":[{"key":"cite_error_references_missing_key","params":["theName"]}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt5\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"theName\"},\"body\":{\"id\":\"mw-reference-text-cite_note-theName-2\"},\"errors\":[{\"key\":\"cite_error_references_missing_key\",\"params\":[\"theName\"]}]}'><a href=\"./Parser_test#cite_note-theName-2\" style=\"counter-reset: mw-Ref 2;\"><span class=\"mw-reflink-text\">[2]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> theFollows</span></span></li><li about="#cite_note-theName-2" id="cite_note-theName-2"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-theName-2" class="mw-reference-text">theValue</span></li></ol></div>
2019-11-22 10:28:45 +00:00
!! end
2021-07-30 15:03:25 +00:00
## Note that the Cite extension of the legacy parser is putting paragraphs
## as direct descendents of ordered lists (instead of inside list items,
## or wherehaveyou)
2019-11-22 10:28:45 +00:00
!! test
2019-11-22 17:28:51 +00:00
A follow="…" before its parent is not merged
2019-11-22 10:28:45 +00:00
!! wikitext
<ref follow="theName">theFollows</ref>
<ref name="theName">theValue</ref>
2021-07-30 15:03:25 +00:00
<references />
!! html/php
2020-04-01 22:13:31 +00:00
<p><sup id="cite_ref-theName_2-0" class="reference"><a href="#cite_note-theName-2">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2020-02-05 10:41:21 +00:00
<p id="cite_note-theName"><span class="reference-text">theFollows</span>
2019-11-22 10:28:45 +00:00
</p>
2020-02-05 10:41:21 +00:00
<li id="cite_note-theName-2"><span class="mw-cite-backlink"><a href="#cite_ref-theName_2-0">↑</a></span> <span class="reference-text">theValue</span>
2019-11-22 10:28:45 +00:00
</li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-1"},"errors":[{"key":"cite_error_references_missing_key","params":["theName"]}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-theName_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-2"}}'><a href="./Parser_test#cite_note-theName-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt2"> theFollows</span></span></li><li about="#cite_note-theName-2" id="cite_note-theName-2"><a href="./Parser_test#cite_ref-theName_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-2" class="mw-reference-text">theValue</span></li></ol></div>
2019-11-22 10:28:45 +00:00
!! end
2021-07-30 15:03:25 +00:00
## This is a nasty edge case which was dropping the ref entirely from the
## output of the Cite extension of the legacy parser
2019-11-22 17:28:51 +00:00
!! test
"follow" after a named ref but before its parent
!! wikitext
<ref name="first">First</ref>
<ref follow="third">Second</ref>
<ref name="third">Third</ref>
<hr />
<references />
!! html/php
<p><sup id="cite_ref-first_1-0" class="reference"><a href="#cite_note-first-1">[1]</a></sup>
2020-02-05 10:41:21 +00:00
</p><p><sup id="cite_ref-third_3-0" class="reference"><a href="#cite_note-third-3">[2]</a></sup>
2019-11-22 17:28:51 +00:00
</p>
<hr />
<div class="mw-references-wrap"><ol class="references">
2020-02-05 10:41:21 +00:00
<p id="cite_note-third"><span class="reference-text">Second</span>
</p>
2019-11-22 17:28:51 +00:00
<li id="cite_note-first-1"><span class="mw-cite-backlink"><a href="#cite_ref-first_1-0">↑</a></span> <span class="reference-text">First</span>
</li>
2020-02-05 10:41:21 +00:00
<li id="cite_note-third-3"><span class="mw-cite-backlink"><a href="#cite_ref-third_3-0">↑</a></span> <span class="reference-text">Third</span>
2019-11-22 17:28:51 +00:00
</li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-first_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"first"},"body":{"id":"mw-reference-text-cite_note-first-1"}}'><a href="./Parser_test#cite_note-first-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"follow":"third"},"body":{"id":"mw-reference-text-cite_note-2"},"errors":[{"key":"cite_error_references_missing_key","params":["third"]}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-third_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"third"},"body":{"id":"mw-reference-text-cite_note-third-3"}}'><a href="./Parser_test#cite_note-third-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<hr data-parsoid='{"stx":"html","selfClose":true}'/>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-first-1" id="cite_note-first-1"><a href="./Parser_test#cite_ref-first_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-first-1" class="mw-reference-text">First</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt4"> Second</span></span></li><li about="#cite_note-third-3" id="cite_note-third-3"><a href="./Parser_test#cite_ref-third_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-third-3" class="mw-reference-text">Third</span></li></ol></div>
2019-11-22 17:28:51 +00:00
!! end
!! test
"follow" after an anonymous ref but before its parent
!! wikitext
<ref>First</ref>
<ref follow="third">Second</ref>
<ref name="third">Third</ref>
<hr />
<references />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2020-02-05 10:41:21 +00:00
</p><p><sup id="cite_ref-third_3-0" class="reference"><a href="#cite_note-third-3">[2]</a></sup>
2019-11-22 17:28:51 +00:00
</p>
<hr />
<div class="mw-references-wrap"><ol class="references">
2020-02-05 10:41:21 +00:00
<p id="cite_note-third"><span class="reference-text">Second</span>
</p>
2019-11-22 17:28:51 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">First</span>
</li>
2020-02-05 10:41:21 +00:00
<li id="cite_note-third-3"><span class="mw-cite-backlink"><a href="#cite_ref-third_3-0">↑</a></span> <span class="reference-text">Third</span>
2019-11-22 17:28:51 +00:00
</li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"follow":"third"},"body":{"id":"mw-reference-text-cite_note-2"},"errors":[{"key":"cite_error_references_missing_key","params":["third"]}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-third_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"third"},"body":{"id":"mw-reference-text-cite_note-third-3"}}'><a href="./Parser_test#cite_note-third-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<hr data-parsoid='{"stx":"html","selfClose":true}'/>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">First</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt4"> Second</span></span></li><li about="#cite_note-third-3" id="cite_note-third-3"><a href="./Parser_test#cite_ref-third_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-third-3" class="mw-reference-text">Third</span></li></ol></div>
2019-11-22 17:28:51 +00:00
!! end
2019-11-22 10:28:45 +00:00
!! test
2020-02-05 10:41:21 +00:00
Valid follow="…" after it's parent
2019-11-22 10:28:45 +00:00
!! wikitext
<ref name="theName">theValue</ref>
<ref follow="theName">theFollows</ref>
2020-02-17 14:29:33 +00:00
<ref>Should be 2</ref>
2021-07-30 15:03:25 +00:00
<references />
!! html/php
2019-11-22 10:28:45 +00:00
<p><sup id="cite_ref-theName_1-0" class="reference"><a href="#cite_note-theName-1">[1]</a></sup>
2020-02-17 14:29:33 +00:00
</p><p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup>
2019-11-22 10:28:45 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-theName-1"><span class="mw-cite-backlink"><a href="#cite_ref-theName_1-0">↑</a></span> <span class="reference-text">theValue theFollows</span>
</li>
2020-02-17 14:29:33 +00:00
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">Should be 2</span>
</li>
2019-11-22 10:28:45 +00:00
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-theName-1" id="cite_note-theName-1"><a href="./Parser_test#cite_ref-theName_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text">theValue<span typeof="mw:Cite/Follow" about="#mwt4"> theFollows</span></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">Should be 2</span></li></ol></div>
2019-11-22 10:28:45 +00:00
!! end
2020-02-05 14:04:49 +00:00
!! test
Forward-referenced ref with follow
!! wikitext
<ref name="theName" />
<ref follow="theName">theFollows</ref>
<references>
<ref name="theName">theValue</ref>
</references>
2021-07-30 15:03:25 +00:00
!! html/php
2020-02-05 14:04:49 +00:00
<p><sup id="cite_ref-theName_1-0" class="reference"><a href="#cite_note-theName-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-theName-1"><span class="mw-cite-backlink"><a href="#cite_ref-theName_1-0">↑</a></span> <span class="reference-text"> theFollows <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "theName" defined multiple times with different content</span></span>
</li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt7\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[75,109,20,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"theName\"},\"body\":{\"html\":\"theValue\"},\"errors\":[{\"key\":\"cite_error_references_duplicate_key\",\"params\":[\"theName\"]}]}'><a href=\"./Parser_test#cite_note-theName-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-theName-1" id="cite_note-theName-1"><a href="./Parser_test#cite_ref-theName_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt4"> theFollows</span></span></li></ol></div>
2020-02-05 14:04:49 +00:00
!! end
2021-07-30 15:03:25 +00:00
!! test
Follow following a named ref with multiple definitions
!! wikitext
<ref name="test">123</ref>
<ref name="test">234</ref>
<ref follow="test">345</ref>
<references />
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-test_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test"},"body":{"id":"mw-reference-text-cite_note-test-1"}}'><a href="./Parser_test#cite_note-test-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-test_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"test"},"body":{"html":"234"},"errors":[{"key":"cite_error_references_duplicate_key","params":["test"]}]}'><a href="./Parser_test#cite_note-test-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"test"},"body":{"id":"mw-reference-text-cite_note-test-1"}}'><a href="./Parser_test#cite_note-test-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-test-1" id="cite_note-test-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-test_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-test_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-test-1" class="mw-reference-text">123<span typeof="mw:Cite/Follow" about="#mwt6"> 345</span></span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Multiple follow after refs without content and trailing ref with content in references section
!! wikitext
ADD<ref name="theName" />
SUB<ref name="theName"></ref>
MUL<ref follow="theName">theFollowValue</ref>
MOD<ref follow="theName">anotherFollowValue</ref>
<references>
<ref name="theName"> theValue</ref>
</references>
!! html/php
<p>ADD<sup id="cite_ref-theName_1-0" class="reference"><a href="#cite_note-theName-1">[1]</a></sup>
SUB<sup id="cite_ref-theName_1-1" class="reference"><a href="#cite_note-theName-1">[1]</a></sup>
MUL
MOD
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-theName-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-theName_1-0">1.0</a></sup> <sup><a href="#cite_ref-theName_1-1">1.1</a></sup></span> <span class="reference-text"> theFollowValue anotherFollowValue <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "theName" defined multiple times with different content</span></span>
</li>
</ol></div>
!! html/parsoid
<p>ADD<sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
SUB<sup about="#mwt4" class="mw-ref reference" id="cite_ref-theName_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"},"body":{"html":""}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
MUL<sup about="#mwt6" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
MOD<sup about="#mwt8" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"}}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt11\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"theName\"},\"body\":{\"html\":\" theValue\"},\"errors\":[{\"key\":\"cite_error_references_duplicate_key\",\"params\":[\"theName\"]}]}'><a href=\"./Parser_test#cite_note-theName-1\" style=\"counter-reset: mw-Ref 1;\"><span class=\"mw-reflink-text\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-theName-1" id="cite_note-theName-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-theName_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-theName_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text"><span typeof="mw:Cite/Follow" about="#mwt6"> theFollowValue</span><span typeof="mw:Cite/Follow" about="#mwt8"> anotherFollowValue</span></span></li></ol></div>
2021-07-30 15:03:25 +00:00
!!end
2022-05-11 23:08:15 +00:00
# T307741: Parsoid fails this test in both standalone and integrated modes.
2018-12-10 11:28:29 +00:00
!! test
2023-12-05 19:59:50 +00:00
Report bad attributes in ref tags
2018-12-10 11:28:29 +00:00
!! wikitext
<ref name="theName" group="theGroup" dummy="dummy">theValue</ref>
<references group="theGroup" />
!! html
2023-12-05 19:59:50 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><ref></code> tag</span>
2018-12-10 11:28:29 +00:00
</p>
!! end
2007-12-16 20:18:33 +00:00
2008-03-21 15:25:26 +00:00
!! test
Simple <ref>, with <references/> in group
2017-02-22 17:21:47 +00:00
!! wikitext
2008-03-21 15:25:26 +00:00
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
2019-01-02 17:31:42 +00:00
Wikipedia rocks!<ref group="note">Proceeds of Rockology, vol. XXI</ref>
2008-03-21 15:25:26 +00:00
2019-01-02 17:31:42 +00:00
<references />
<references group="note" />
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
Wikipedia rocks!<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[note 1]</a></sup>
2008-03-21 15:25:26 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>Wikipedia rocks!<sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
Wikipedia rocks!<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"note"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="note"><span class="mw-reflink-text">[note 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Proceeds of Rockology, vol. XXI</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{"group":"note"}}'><ol class="mw-references references" data-mw-group="note"><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="note" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">Proceeds of Rockology, vol. XXI</span></li></ol></div>
2008-03-21 15:25:26 +00:00
!! end
2008-06-20 18:41:14 +00:00
!! test
2015-07-07 14:18:43 +00:00
Simple <ref>, with <references/> in group, with groupname in Chinese
2017-02-22 17:21:47 +00:00
!! wikitext
2008-06-20 18:41:14 +00:00
AAA<ref group="参">ref a</ref>BBB<ref group="注">note b</ref>CCC<ref group="参">ref c</ref>
;refs
<references group="参" />
2018-08-17 19:39:13 +00:00
2008-06-20 18:41:14 +00:00
;notes
<references group="注" />
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p>AAA<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[参 1]</a></sup>BBB<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[注 1]</a></sup>CCC<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[参 2]</a></sup>
2008-06-20 18:41:14 +00:00
</p>
2014-06-11 18:00:07 +00:00
<dl><dt>refs</dt></dl>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">ref a</span>
2011-11-14 12:20:24 +00:00
</li>
2012-10-17 22:58:55 +00:00
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">ref c</span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2014-06-11 18:00:07 +00:00
<dl><dt>notes</dt></dl>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">note b</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>AAA<sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"参"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="参"><span class="mw-reflink-text">[参 1]</span></a></sup>BBB<sup about="#mwt5" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"注"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="注"><span class="mw-reflink-text">[注 1]</span></a></sup>CCC<sup about="#mwt6" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"参"},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 2;" data-mw-group="参"><span class="mw-reflink-text">[参 2]</span></a></sup></p>
<dl><dt>refs</dt></dl>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{"group":"参"}}'><ol class="mw-references references" data-mw-group="参"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="参" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">ref a</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" data-mw-group="参" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">ref c</span></li></ol></div>
<dl><dt>notes</dt></dl>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"注"}}'><ol class="mw-references references" data-mw-group="注"><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="注" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">note b</span></li></ol></div>
2008-06-20 18:41:14 +00:00
!! end
2009-07-26 22:15:13 +00:00
2022-05-11 23:08:15 +00:00
## No point running non-wt2html modes with Parsoid since the " g "
## will get normalized and html2wt, wt2wt, html2html modes will fail.
2019-11-27 11:44:25 +00:00
!! test
Attributes are trimmed by the parser, see Sanitizer::decodeTagAttributes()
2022-05-11 23:08:15 +00:00
!! options
parsoid=wt2html
2019-11-27 11:44:25 +00:00
!! wikitext
<ref group="g" name="n1">in group g</ref>
<ref group=" g " name=" n2 ">in group " g "</ref>
<references group="g" />
<references group=" g " />
!! html
<p><sup id="cite_ref-n1_1-0" class="reference"><a href="#cite_note-n1-1">[g 1]</a></sup>
<sup id="cite_ref-n2_2-0" class="reference"><a href="#cite_note-n2-2">[g 2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-n1-1"><span class="mw-cite-backlink"><a href="#cite_ref-n1_1-0">↑</a></span> <span class="reference-text">in group g</span>
</li>
<li id="cite_note-n2-2"><span class="mw-cite-backlink"><a href="#cite_ref-n2_2-0">↑</a></span> <span class="reference-text">in group " g "</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-n1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"g","name":"n1"},"body":{"id":"mw-reference-text-cite_note-n1-1"}}'><a href="./Parser_test#cite_note-n1-1" style="counter-reset: mw-Ref 1;" data-mw-group="g"><span class="mw-reflink-text">[g 1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-n2_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"g","name":"n2"},"body":{"id":"mw-reference-text-cite_note-n2-2"}}'><a href="./Parser_test#cite_note-n2-2" style="counter-reset: mw-Ref 2;" data-mw-group="g"><span class="mw-reflink-text">[g 2]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{"group":"g"}}'><ol class="mw-references references" data-mw-group="g"><li about="#cite_note-n1-1" id="cite_note-n1-1"><a href="./Parser_test#cite_ref-n1_1-0" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-n1-1" class="mw-reference-text">in group g</span></li><li about="#cite_note-n2-2" id="cite_note-n2-2"><a href="./Parser_test#cite_ref-n2_2-0" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-n2-2" class="mw-reference-text">in group " g "</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"g"}}'><ol class="mw-references references" data-mw-group="g"></ol></div>
2019-11-27 11:44:25 +00:00
!! end
2009-07-26 22:15:13 +00:00
!! test
<ref> defined in <references>
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="foo" />
2009-07-26 22:15:13 +00:00
<references>
<ref name="foo">BAR</ref>
</references>
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
2009-07-26 22:15:13 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt8\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[33,58,16,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\"},\"body\":{\"id\":\"mw-reference-text-cite_note-foo-1\"}}'><a href=\"./Parser_test#cite_note-foo-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><a href="./Parser_test#cite_ref-foo_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">BAR</span></li></ol></div>
2009-07-26 22:15:13 +00:00
!! end
!! test
<ref> defined in <references> called with #tag
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="foo" />
2009-07-26 22:15:13 +00:00
{{#tag:references|
2023-12-11 16:23:16 +00:00
<Ref name="foo">BAR</ref>
2009-07-26 22:15:13 +00:00
}}
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
2009-07-26 22:15:13 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2023-12-11 16:23:16 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt6" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:references","function":"tag"},"params":{"1":{"wt":"\n<Ref name=\"foo\">BAR</ref>\n"}},"i":0}}]}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><a href="./Parser_test#cite_ref-foo_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">BAR</span></li></ol></div>
2009-07-26 22:15:13 +00:00
!! end
2022-05-11 23:08:15 +00:00
# T307741: Parsoid fails this test in both standalone and integrated modes.
2020-01-14 09:24:28 +00:00
!! test
T242437 - Nested references edge case, outer tag function with LDR
!! wikitext
<ref name="foo" />
{{#tag:references|
<ref name="foo">bar</ref>
2023-12-11 16:23:16 +00:00
<References />
2020-01-14 09:24:28 +00:00
}}
2024-01-27 05:56:41 +00:00
!! html/php
2020-01-14 09:24:28 +00:00
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Closing tag missing for <code><references></code></span>
</p>
2024-01-27 05:56:41 +00:00
!! html/parsoid
Parsoid fails this right now
2020-01-14 09:24:28 +00:00
!! end
2022-05-11 23:08:15 +00:00
# T307741: Parsoid fails this test in both standalone and integrated modes.
2020-01-14 09:24:28 +00:00
!! test
T242437 - Nested references edge case, outer tag function, inner LDR
!! wikitext
<ref name="foo" />
{{#tag:references|
<references>
<ref name="foo">bar</ref>
</references>
}}
2024-01-27 05:56:41 +00:00
!! html/php
2020-01-14 09:24:28 +00:00
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Closing tag missing for <code><references></code></span>
</p>
2024-01-27 05:56:41 +00:00
!! html/parsoid
Parsoid fails this right now
2020-01-14 09:24:28 +00:00
!! end
!! test
T242437 - Nested references edge case, inner tag function with LDR
!! wikitext
<ref name="foo" />
<references>
{{#tag:references|
<ref name="foo">bar</ref>
}}
</references>
!! html
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">bar</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt13" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt11\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"src\":\"&lt;ref name=\\\"foo\\\">bar&lt;/ref>\"}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\"},\"body\":{\"id\":\"mw-reference-text-cite_note-foo-1\"}}'><a href=\"./Parser_test#cite_note-foo-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><a href="./Parser_test#cite_ref-foo_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">bar</span></li></ol></div>
2020-01-14 09:24:28 +00:00
!! end
2009-07-26 22:15:13 +00:00
!! test
<ref> defined in <references> error conditions
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="foo" group="2" />
2009-07-26 22:15:13 +00:00
<references group="2">
2019-01-02 17:31:42 +00:00
<ref name="foo" />
2009-07-26 22:15:13 +00:00
<ref name="unused">BAR</ref>
<ref name="foo" group="1">bad group</ref>
2021-07-30 15:03:25 +00:00
<ref name="bar" group="1" />
2009-07-26 22:15:13 +00:00
<ref>BAR BAR</ref>
</references>
2021-07-30 15:03:25 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[2 1]</a></sup>
2009-07-26 22:15:13 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2020-01-23 11:56:25 +00:00
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>foo</code></span></li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-08-20 09:36:45 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "foo" defined in <code><references></code> group "2" has no content.</span><br />
2019-12-17 12:04:50 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "unused" defined in <code><references></code> is not used in prior text.</span><br />
2015-10-08 20:38:01 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag in <code><references></code> has conflicting group attribute "1".</span><br />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> has no name attribute.</span>
2009-07-26 22:15:13 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"foo","group":"2"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;" data-mw-group="2"><span class="mw-reflink-text">[2 1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt14" data-mw='{"name":"references","attrs":{"group":"2"},"body":{"html":"\n<sup about=\"#mwt9\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\"},\"errors\":[{\"key\":\"cite_error_empty_references_define\",\"params\":[\"foo\"]},{\"key\":\"cite_error_references_no_text\"}]}'><a href=\"./Parser_test#cite_note-foo-1\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"2\"><span class=\"mw-reflink-text\">[2 1]</span></a></sup>\n<sup about=\"#mwt10\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"unused\"},\"body\":{\"id\":\"mw-reference-text-cite_note-unused-2\"},\"errors\":[{\"key\":\"cite_error_references_missing_key\",\"params\":[\"unused\"]}]}'><a href=\"./Parser_test#cite_note-unused-2\" style=\"counter-reset: mw-Ref 2;\" data-mw-group=\"2\"><span class=\"mw-reflink-text\">[2 2]</span></a></sup>\n<sup about=\"#mwt11\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\",\"group\":\"1\"},\"body\":{\"id\":\"mw-reference-text-cite_note-foo-3\"},\"errors\":[{\"key\":\"cite_error_references_group_mismatch\",\"params\":[\"1\"]},{\"key\":\"cite_error_references_missing_key\",\"params\":[\"foo\"]},{\"key\":\"cite_error_group_refs_without_references\",\"params\":[\"1\"]}]}'><a href=\"./Parser_test#cite_note-foo-3\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"1\"><span class=\"mw-reflink-text\">[1 1]</span></a></sup>\n<sup about=\"#mwt12\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"bar\",\"group\":\"1\"},\"errors\":[{\"key\":\"cite_error_references_group_mismatch\",\"params\":[\"1\"]},{\"key\":\"cite_error_references_missing_key\",\"params\":[\"bar\"]},{\"key\":\"cite_error_empty_references_define\",\"params\":[\"bar\"]},{\"key\":\"cite_error_group_refs_without_references\",\"params\":[\"1\"]},{\"key\":\"cite_error_references_no_text\"}]}'><a href=\"./Parser_test#cite_note-bar-4\" style=\"counter-reset: mw-Ref 2;\" data-mw-group=\"1\"><span class=\"mw-reflink-text\">[1 2]</span></a></sup>\n<sup about=\"#mwt13\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-5\"},\"errors\":[{\"key\":\"cite_error_references_no_key\"}]}'><a href=\"./Parser_test#cite_note-5\" style=\"counter-reset: mw-Ref 3;\" data-mw-group=\"2\"><span class=\"mw-reflink-text\">[2 3]</span></a></sup>\n"}}'><ol class="mw-references references" data-mw-group="2"><li about="#cite_note-foo-1" id="cite_note-foo-1"><a href="./Parser_test#cite_ref-foo_1-0" data-mw-group="2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text"></span></li><li about="#cite_note-unused-2" id="cite_note-unused-2"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-unused-2" class="mw-reference-text">BAR</span></li><li about="#cite_note-5" id="cite_note-5"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-5" class="mw-reference-text">BAR BAR</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-mw='{"name":"references","attrs":{"group":"1"},"autoGenerated":true}'><ol class="mw-references references" data-mw-group="1"><li about="#cite_note-foo-3" id="cite_note-foo-3"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-foo-3" class="mw-reference-text">bad group</span></li><li about="#cite_note-bar-4" id="cite_note-bar-4"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-bar-4" class="mw-reference-text"></span></li></ol></div>
2009-07-26 22:15:13 +00:00
!! end
2019-12-17 12:04:50 +00:00
2020-07-15 15:39:36 +00:00
!! test
<ref> ungrouped and grouped refs with and without content defined
!! wikitext
ONE<ref name="foo" />
<references />
TWO<ref group="NOTES" name="foo" />
THREE<ref group="NOTES" name="bar">CONTENT</ref>
<references group="NOTES" />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>ONE<sup about="#mwt3" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><a href="./Parser_test#cite_ref-foo_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text"></span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p>TWO<sup about="#mwt9" class="mw-ref reference" id="cite_ref-foo_2-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-2" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup>
THREE<sup about="#mwt12" class="mw-ref reference" id="cite_ref-bar_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"bar"},"body":{"id":"mw-reference-text-cite_note-bar-3"}}'><a href="./Parser_test#cite_note-bar-3" style="counter-reset: mw-Ref 2;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-parsoid='{"group":"NOTES"}' data-mw='{"name":"references","attrs":{"group":"NOTES"}}'><ol class="mw-references references" data-mw-group="NOTES"><li about="#cite_note-foo-2" id="cite_note-foo-2"><a href="./Parser_test#cite_ref-foo_2-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-2" class="mw-reference-text"></span></li><li about="#cite_note-bar-3" id="cite_note-bar-3"><a href="./Parser_test#cite_ref-bar_3-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-bar-3" class="mw-reference-text">CONTENT</span></li></ol></div>
2020-07-15 15:39:36 +00:00
!! html/php
<p>ONE<sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>foo</code></span></li>
</ol></div>
<p>TWO<sup id="cite_ref-foo_2-0" class="reference"><a href="#cite_note-foo-2">[NOTES 1]</a></sup>
THREE<sup id="cite_ref-bar_3-0" class="reference"><a href="#cite_note-bar-3">[NOTES 2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-foo-2"><span class="mw-cite-backlink"><a href="#cite_ref-foo_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>foo</code></span></li>
<li id="cite_note-bar-3"><span class="mw-cite-backlink"><a href="#cite_ref-bar_3-0">↑</a></span> <span class="reference-text">CONTENT</span>
</li>
</ol></div>
!! end
2019-12-17 12:04:50 +00:00
!! test
Error conditions on non-visible content
!! wikitext
<ref name="a">x</ref>
<ref name="b"> </ref>
<ref name="c" />
<references>
<ref name="a" />
<ref name="b" />
<ref name="c"> </ref>
</references>
2020-07-15 15:39:36 +00:00
!! html/php
2019-12-17 12:04:50 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup>
<sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[3]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">x</span>
</li>
2020-01-23 11:56:25 +00:00
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>b</code></span></li>
<li id="cite_note-c-3"><span class="mw-cite-backlink"><a href="#cite_ref-c_3-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>c</code></span></li>
2019-12-17 12:04:50 +00:00
</ol></div>
2022-08-20 09:36:45 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "a" defined in <code><references></code> group "" has no content.</span><br />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "b" defined in <code><references></code> group "" has no content.</span><br />
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "c" defined in <code><references></code> group "" has no content.</span>
2019-12-17 12:04:50 +00:00
</p>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"b"},"body":{"html":" "},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-c_3-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"c"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-c-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt14" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt11\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[74,90,16,0]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"errors\":[{\"key\":\"cite_error_empty_references_define\",\"params\":[\"a\"]}]}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\"><span class=\"mw-reflink-text\">[1]</span></a></sup>\n<sup about=\"#mwt12\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[91,107,16,0]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"b\"},\"errors\":[{\"key\":\"cite_error_empty_references_define\",\"params\":[\"b\"]},{\"key\":\"cite_error_references_no_text\"}]}'><a href=\"./Parser_test#cite_note-b-2\" style=\"counter-reset: mw-Ref 2;\"><span class=\"mw-reflink-text\">[2]</span></a></sup>\n<sup about=\"#mwt13\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[108,129,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"c\"},\"body\":{\"html\":\" \"},\"errors\":[{\"key\":\"cite_error_empty_references_define\",\"params\":[\"c\"]},{\"key\":\"cite_error_references_no_text\"}]}'><a href=\"./Parser_test#cite_note-c-3\" style=\"counter-reset: mw-Ref 3;\"><span class=\"mw-reflink-text\">[3]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">x</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Parser_test#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text"></span></li><li about="#cite_note-c-3" id="cite_note-c-3"><a href="./Parser_test#cite_ref-c_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-c-3" class="mw-reference-text"></span></li></ol></div>
2019-12-17 12:04:50 +00:00
!! end
2009-07-26 22:15:13 +00:00
2022-05-11 23:08:15 +00:00
# This article is used in the '<ref> with custom group link' test below
2010-05-22 14:28:48 +00:00
!! article
MediaWiki:cite_link_label_group-klingon
!! text
2018-11-19 15:36:01 +00:00
wa' cha' wej loS vagh jav Soch chorgh Hut wa'maH
2010-05-22 14:28:48 +00:00
!! endarticle
2022-05-11 23:08:15 +00:00
## Parsoid doesn't use messages for i18n. It relies on Cite-specific CSS rules
## to localize. This CSS is expected to be added to a wiki's
## MediaWiki:Common.css page.
## As such, Parsoid's output will differ for klingon i18n label tests.
## T308094: document this transition.
2010-05-22 14:28:48 +00:00
!! test
2015-07-07 14:18:43 +00:00
<ref> with custom group link with number names in Klingon
2017-02-22 17:21:47 +00:00
!! wikitext
2010-05-22 14:28:48 +00:00
Wikipedia rocks!<ref group="klingon">Proceeds of Rockology, vol. XXI</ref>
2019-01-02 17:31:42 +00:00
<references group="klingon" />
2017-02-22 17:21:47 +00:00
!! html
2017-09-18 19:17:06 +00:00
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[wa']</a></sup>
2010-05-22 14:28:48 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>Wikipedia rocks!<sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"klingon"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="klingon"><span class="mw-reflink-text">[klingon 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{"group":"klingon"}}'><ol class="mw-references references" data-mw-group="klingon"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="klingon" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Proceeds of Rockology, vol. XXI</span></li></ol></div>
2010-05-22 14:28:48 +00:00
!! end
2011-12-13 11:16:51 +00:00
2022-05-11 23:08:15 +00:00
# See above: Parsoid uses a different mechanism for custom link labels
2018-11-19 15:36:01 +00:00
!! test
Consecutive whitespace in custom link label message should not create empty []
!! wikitext
<ref group="klingon">1st</ref>
<ref group="klingon">2nd</ref>
<references group="klingon" />
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[wa']</a></sup>
<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[cha']</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">1st</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">2nd</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"klingon"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="klingon"><span class="mw-reflink-text">[klingon 1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"klingon"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;" data-mw-group="klingon"><span class="mw-reflink-text">[klingon 2]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{"group":"klingon"}}'><ol class="mw-references references" data-mw-group="klingon"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="klingon" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1st</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="klingon" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2nd</span></li></ol></div>
2018-11-19 15:36:01 +00:00
!! end
2011-12-13 11:16:51 +00:00
!! test
Bug 31374 regression check: nested strip items
2017-02-22 17:21:47 +00:00
!! wikitext
2011-12-13 11:16:51 +00:00
{{#tag:ref|note<ref>reference</ref>|group=Note}}
2019-01-02 17:31:42 +00:00
<references group="Note" />
2011-12-13 11:16:51 +00:00
<references />
2017-02-22 17:21:47 +00:00
!! html
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[Note 1]</a></sup>
2011-12-13 11:16:51 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2016-03-16 20:29:32 +00:00
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">note<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
<div class="mw-references-wrap"><ol class="references">
2015-06-08 14:05:06 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">reference</span>
2012-10-30 16:22:47 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"note<ref>reference</ref>"},"group":{"wt":"Note"}},"i":0}}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="Note"><span class="mw-reflink-text">[Note 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{"group":"Note"}}'><ol class="mw-references references" data-mw-group="Note"><li about="#cite_note_2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="Note" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">note<sup about="#mwt6" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt13" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">reference</span></li></ol></div>
2012-10-30 16:22:47 +00:00
!! end
!! test
Bug 13073 regression check: wrapped <references>
2017-02-22 17:21:47 +00:00
!! options
parsoid={"suppressErrors": true}
!! wikitext
2012-10-30 16:22:47 +00:00
<ref>
foo
</ref>
<div><references /></div>
2022-05-11 23:08:15 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
2012-10-30 16:22:47 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div><div class="mw-references-wrap"><ol class="references">
2012-10-30 16:22:47 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">
foo</span>
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">
foo
</span></li></ol></div></div>
2011-12-13 11:16:51 +00:00
!! end
2015-07-05 09:40:14 +00:00
!! test
<ref> with no name and no content.
2017-02-22 17:21:47 +00:00
!! wikitext
2015-07-05 09:40:14 +00:00
Bla.<ref></ref>
2020-07-15 15:39:36 +00:00
foo.<ref />
zero{{1x|<ref />}}
<references />
!! html/php
2020-01-23 11:56:25 +00:00
<p>Bla.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; refs with no name must have content</span>
2020-07-15 15:39:36 +00:00
foo.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code><ref></code> tag is malformed or has a bad name</span>
zero<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code><ref></code> tag is malformed or has a bad name</span>
2015-07-05 09:40:14 +00:00
</p>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Bla.<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{},"body":{"html":""},"errors":[{"key":"cite_error_ref_no_input"}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
foo.<sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{},"errors":[{"key":"cite_error_ref_no_key"}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
zero<sup about="#mwt8" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref mw:Error" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<ref />"}},"i":0}}],"errors":[{"key":"cite_error_ref_no_key"}]}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt13" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"></span></li></ol></div>
2015-07-05 09:40:14 +00:00
!! end
2015-07-07 12:16:26 +00:00
!! test
<ref> with an empty-string name parameter and no content.
2017-02-22 17:21:47 +00:00
!! wikitext
2019-11-20 14:44:12 +00:00
Bla.<ref name=""> </ref>
2020-07-15 15:39:36 +00:00
<references />
!! html/php
2020-01-23 11:56:25 +00:00
<p>Bla.<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; refs with no name must have content</span>
2015-07-07 12:16:26 +00:00
</p>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Bla.<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":""},"body":{"html":" "},"errors":[{"key":"cite_error_ref_no_input"}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li></ol></div>
2020-07-15 15:39:36 +00:00
!! end
!! test
<ref> with whitespace only name parameter and no content.
!! options
parsoid=wt2html
!! wikitext
Hi <ref name=" "> </ref>
Ho <ref name=" " />
!! html/php
<p>Hi <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; refs with no name must have content</span>
Ho <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: The opening <code><ref></code> tag is malformed or has a bad name</span>
</p>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Hi <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":""},"body":{"html":" "},"errors":[{"key":"cite_error_ref_no_input"}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
Ho <sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":""},"errors":[{"key":"cite_error_ref_no_key"}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol></div>
2015-07-07 12:16:26 +00:00
!! end
!! test
2015-07-09 14:47:47 +00:00
<ref> with a non-empty name parameter and no content.
2017-02-22 17:21:47 +00:00
!! wikitext
2019-11-20 14:44:12 +00:00
Bla.<ref name="void"> </ref>
2020-07-15 15:39:36 +00:00
<references />
!! html/php
2020-04-01 22:13:31 +00:00
<p>Bla.<sup id="cite_ref-void_1-0" class="reference"><a href="#cite_note-void-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2020-01-23 11:56:25 +00:00
<li id="cite_note-void-1"><span class="mw-cite-backlink"><a href="#cite_ref-void_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>void</code></span></li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Bla.<sup about="#mwt3" class="mw-ref reference" id="cite_ref-void_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"void"},"body":{"html":" "},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-void-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-void-1" id="cite_note-void-1"><a href="./Parser_test#cite_ref-void_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-void-1" class="mw-reference-text"></span></li></ol></div>
2020-07-15 15:39:36 +00:00
!! end
!! test
Whitespace only doesn't set content for named ref
!! wikitext
Hi <ref name="ho"> </ref>
Hi <ref name="ho">Off to work we go!</ref>
<references />
!! html/php
<p>Hi <sup id="cite_ref-ho_1-0" class="reference"><a href="#cite_note-ho-1">[1]</a></sup>
Hi <sup id="cite_ref-ho_1-1" class="reference"><a href="#cite_note-ho-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-ho-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-ho_1-0">1.0</a></sup> <sup><a href="#cite_ref-ho_1-1">1.1</a></sup></span> <span class="reference-text">Off to work we go!</span>
</li>
</ol></div>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Hi <sup about="#mwt3" class="mw-ref reference" id="cite_ref-ho_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"ho"},"body":{"html":" "}}'><a href="./Parser_test#cite_note-ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
Hi <sup about="#mwt6" class="mw-ref reference" id="cite_ref-ho_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"ho"},"body":{"id":"mw-reference-text-cite_note-ho-1"}}'><a href="./Parser_test#cite_note-ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-ho-1" id="cite_note-ho-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-ho_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-ho_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-ho-1" class="mw-reference-text">Off to work we go!</span></li></ol></div>
2015-07-07 12:16:26 +00:00
!! end
2015-08-02 14:53:56 +00:00
2015-10-28 14:15:48 +00:00
!! test
Multiple definition (outside <references/>)
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="a">abc</ref>
<ref name="a">def</ref>
2015-10-28 14:15:48 +00:00
<references />
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2015-10-28 14:15:48 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a" defined multiple times with different content</span></span>
2015-10-28 14:15:48 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"html":"def"},"errors":[{"key":"cite_error_references_duplicate_key","params":["a"]}]}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li></ol></div>
2015-10-28 14:15:48 +00:00
!! end
!! test
Multiple definition (inside <references/>)
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="a" />
2015-10-28 14:15:48 +00:00
<references>
2019-01-02 17:31:42 +00:00
<ref name="a">abc</ref>
<ref name="a">def</ref>
2015-10-28 14:15:48 +00:00
</references>
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2015-10-28 14:15:48 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a" defined multiple times with different content</span></span>
2015-10-28 14:15:48 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt8\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[30,53,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"}}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n<sup about=\"#mwt10\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[54,77,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"body\":{\"html\":\"def\"},\"errors\":[{\"key\":\"cite_error_references_duplicate_key\",\"params\":[\"a\"]}]}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li></ol></div>
2015-10-28 14:15:48 +00:00
!! end
!! test
Multiple definition (mixed outside/inside)
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="a">abc</ref>
2015-10-28 14:15:48 +00:00
<references>
2019-01-02 17:31:42 +00:00
<ref name="a">def</ref>
2015-10-28 14:15:48 +00:00
</references>
2020-07-15 15:39:36 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
2015-10-28 14:15:48 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a" defined multiple times with different content</span></span>
2015-10-28 14:15:48 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2020-07-15 15:39:36 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt7\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-parsoid='{\"dsr\":[37,60,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"body\":{\"html\":\"def\"},\"errors\":[{\"key\":\"cite_error_references_duplicate_key\",\"params\":[\"a\"]}]}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li></ol></div>
2015-10-28 14:15:48 +00:00
!! end
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
2023-02-28 15:52:39 +00:00
!! test
2023-12-14 08:13:14 +00:00
T202593: Conflicting dir attributes
2023-02-28 15:52:39 +00:00
!! wikitext
<ref name="a" dir="ltr" />
<ref name="a" dir="rtl">abc</ref>
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2023-12-14 08:13:14 +00:00
<li id="cite_note-a-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: One of the <code><ref></code> tags with the name "a" does have a conflicting dir attribute.</span></span>
</li>
</ol></div>
2024-01-05 19:25:07 +00:00
!! html/parsoid
2023-12-14 08:13:14 +00:00
<p><sup class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","dir":"ltr"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2024-01-19 18:24:55 +00:00
<sup class="mw-ref reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"a","dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-a-1"},"errors":[{"key":"cite_error_ref_conflicting_dir","params":["a"]}]}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2023-12-14 08:13:14 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
<ol class="mw-references references">
<li id="cite_note-a-1" class="mw-cite-dir-rtl"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li>
</ol>
</div>
!! end
!! test
T202593: Conflicting dir attributes with the full ref first
!! wikitext
<ref name="a" dir="ltr">abc</ref>
<ref name="a" dir="rtl" />
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: One of the <code><ref></code> tags with the name "a" does have a conflicting dir attribute.</span></span>
</li>
</ol></div>
2024-01-05 19:25:07 +00:00
!! html/parsoid
2023-12-14 08:13:14 +00:00
<p><sup class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","dir":"ltr"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2024-01-19 18:24:55 +00:00
<sup class="mw-ref reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"a","dir":"rtl"},"errors":[{"key":"cite_error_ref_conflicting_dir","params":["a"]}]}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2023-12-14 08:13:14 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
<ol class="mw-references references">
<li id="cite_note-a-1" class="mw-cite-dir-ltr"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li>
</ol>
</div>
!! end
!! test
T202593: Identical dir attributes are pointless, but should not generate an error
!! wikitext
2024-01-03 08:03:37 +00:00
<ref name="a" dir="RTL" />
2023-12-14 08:13:14 +00:00
<ref name="a" dir="rtl">abc</ref>
<references />
!! html/php
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2023-02-28 15:52:39 +00:00
<li id="cite_note-a-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">abc</span>
</li>
</ol></div>
!! html/parsoid
2024-01-19 18:24:55 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","dir":"RTL"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1" class="mw-cite-dir-rtl"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">abc</span></li></ol></div>
2023-02-28 15:52:39 +00:00
!! end
2022-05-11 23:08:15 +00:00
# T307741: Parsoid fails this test in both standalone and integrated modes.
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
!! test
Multiple definition (inside {{#tag:references}})
2017-02-22 17:21:47 +00:00
!! wikitext
2019-01-02 17:31:42 +00:00
<ref name="a" />
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
{{#tag:references|
2019-01-02 17:31:42 +00:00
<ref name="a">abc</ref>
<ref name="a">def</ref>
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
}}
2020-07-15 15:39:36 +00:00
<references />
2024-01-27 05:56:41 +00:00
!! html/php
2016-03-16 20:29:32 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
</p>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
<div class="mw-references-wrap"><ol class="references">
2015-10-08 20:38:01 +00:00
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">abc <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a" defined multiple times with different content</span></span>
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
</li>
Implement responsive columns for reference lists
This is based on the popular 'count' parameter from Template:Reflist on
English Wikipedia, which has also been adopted by many other wikis.
That template's 'count' parameter allows maximum flexibility on a per-
page basis. This was important because the template can't know how many
references the list will contain. Users typically manually add (and
later, increment) the 'count' parameter when the list exceeds a certain
threshold.
The template currently sets an exact column count (via the CSS3
property `column-count`).
This patch improves on that by instead using the closely related CSS3
`column-width` property. This automatically derives the column count
based on the available space in the browser window. It will thus create
two or three columns on a typical desktop screen, and two or no columns
on a mobile device.
The specified width is the minimum width of a column. This ensures that
the list is not split when rendered on a narrow screen or mobile device.
It also hooks into the raw list before parsing and adds the class only
when the list will contain more than a certain number of items. This
prevents very short lists from being split into multiple columns.
Templates like Template:Reflist on English Wikipedia currently are not
able to set inline styles on the list element directly, which is why
they set it on a `<div>` wrapping the `<references />` output. Because
of this, the feature of the Cite extension must not be enabled at the
same time, as that would result in both the template's wrapper and the
references list being split. The end result would involve sitations with
three columns split in four sub-columns, creating a complicated mess of
nine intermixed columns.
To provide a smooth migration for wikis, this feature can be disabled by
default using `$wgCiteResponsiveReferences = false`. Each individual
template createing reference list can then be migrated, by removing the
wrapper column styles and instead settting the new "responsive"
attribute, like so: `<references responsive />`.
Once any conflicting templates have been migrated, the default for the
wiki can be swapped by setting `$wgCiteResponsiveReferences = true`.
If wikis wish for some templates to keep their custom column splitting
behaviour, templates can also opt-out by setting `responsive="0"`, which
will make sure that it will keep behaving the current way even after the
feature becomes enabled by default for the wiki.
In summary, when disabled by default, pages can opt into this system
with `<references responsive />`. When enabled by default, pages can opt
out of the system with `<references responsive=0 />`.
* Deprecate cite_references_prefix/cite_references_suffix.
This message is rarely used and opens up compatibility hazards.
It was already removed by Parsoid, but the PHP implementation
still had it. It's typically used to add inline styles to the
wrapper which is more appropiately done in Common.css (or
obsoleted as part of the skin or Cite extenion itself nowadays
depending on what style in question).
It was also a HTML-style message with separated open and close
segments, which is an anti-pattern in itself.
* Declare module target explicitly and include mobile. The absence of
this stylesheet caused subtle BiDi/RTL bugs on mobile.
Bug: T33597
Change-Id: Ia535f9b722e825e71e792b36356febc3bd444387
2015-07-21 02:33:50 +00:00
</ol></div>
2024-01-27 05:56:41 +00:00
!! html/parsoid
Parsoid fails this right now
Rollback all, then redo all, when fixing out-of-order tags; not one-by-one
Imagine the following wikitext:
<ref name=r/>
<references>
<ref name=r>A</ref>
<ref name=r>B</ref>
</references>
This is simple. Cite would see these as the following operations, in
order:
1. Use only: <ref name=r/>
2. References block
3. Define only: <ref name=r>A</ref>
4. Define only: <ref name=r>B</ref>
<ref name=r> is defined twice with different content and we get an
error message.
Now, imagine the following wikitext:
<ref name=r/>
{{#tag:references|
<ref name=r>A</ref>
<ref name=r>B</ref>
}}
Cite would see these as the following operations, in order:
1. Use only: <ref name=r/>
2. Use and define: <ref name=r>A</ref>
3. Use and define: <ref name=r>B</ref>
4. References block
When the 'references' block appears, Cite notices that the tag has
parsed content, and deduces that it was called with #tag. We need to
undo the last operations to update internal bookkeeping, as the last
two 'ref' tags do not actually represent ref usages, as we assumed,
but only definitions.
5. Undo: <ref name=r> reused
6. Define only: <ref name=r>B</ref>
7. Undo: <ref name=r> defined
(Right now, it appears to Cite that <ref name=r> was never defined!)
8. Define only: <ref name=r>A</ref>
Thus we get no errors, although we should.
This patch changes the order of the rollback operations:
5. Undo: <ref name=r> reused
6. Undo: <ref name=r> defined
7. Define only: <ref name=r>A</ref>
8. Define only: <ref name=r>B</ref>
Aha! <ref name=r> is defined twice with different content! We get an
error correctly.
Bug: T124227
Change-Id: I61766c4104856323987cca9a5e4ff85a76b3618b
2016-01-20 20:38:59 +00:00
!! end
2017-02-22 17:21:47 +00:00
2018-03-07 07:23:31 +00:00
# Parsoid doesn't rt cleanly because name attribute is actually broken
# here (<ref> tag closes at first >); see next test for a tidied version.
2017-11-10 01:21:54 +00:00
!! test
T29694 - [] in reference names in HTML5 fragment mode
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5" ]
2018-03-07 07:23:31 +00:00
!! options
parsoid=wt2html
2017-11-10 01:21:54 +00:00
!! wikitext
<ref name="[#foo] {bar} <baz>">[bar]</ref>
2018-03-07 07:23:31 +00:00
!! html/php
2020-04-01 22:13:31 +00:00
<p><sup id="cite_ref-[#foo]_{bar}_<baz_1-0" class="reference"><a href="#cite_note-[#foo]_{bar}_<baz-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2017-11-10 01:21:54 +00:00
<li id="cite_note-[#foo]_{bar}_<baz-1"><span class="mw-cite-backlink"><a href="#cite_ref-[#foo]_{bar}_<baz_1-0">↑</a></span> <span class="reference-text">">[bar]</span>
</li>
</ol></div>
2018-03-07 07:23:31 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-[#foo]_{bar}_<baz_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} <baz"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_<baz-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_<baz-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-[#foo]_{bar}_<baz-1" id="cite_note-[#foo]_{bar}_<baz-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-[#foo]_{bar}_<baz-1" class="mw-reference-text">">[bar]</span></li></ol></div>
2018-03-07 07:23:31 +00:00
!! end
!! test
T29694 - [] in reference names in HTML5 fragment mode (tidied)
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5" ]
2018-03-07 07:23:31 +00:00
!! wikitext
<ref name="[#foo] {bar} <baz>">[bar]</ref>
<references />
!! html/php
<p><sup id="cite_ref-[#foo]_{bar}_<baz>_1-0" class="reference"><a href="#cite_note-[#foo]_{bar}_<baz>-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-[#foo]_{bar}_<baz>-1"><span class="mw-cite-backlink"><a href="#cite_ref-[#foo]_{bar}_<baz>_1-0">↑</a></span> <span class="reference-text">[bar]</span>
</li>
</ol></div>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-[#foo]_{bar}_<baz>_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"[#foo] {bar} <baz>"},"body":{"id":"mw-reference-text-cite_note-[#foo]_{bar}_<baz>-1"}}'><a href="./Parser_test#cite_note-[#foo]_{bar}_<baz>-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-[#foo]_{bar}_<baz>-1" id="cite_note-[#foo]_{bar}_<baz>-1"><a href="./Parser_test#cite_ref-[#foo]_{bar}_<baz>_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-[#foo]_{bar}_<baz>-1" class="mw-reference-text">[bar]</span></li></ol></div>
2017-11-10 01:21:54 +00:00
!! end
2017-02-22 17:21:47 +00:00
#### ----------------------------------------------------------------
#### 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
2021-07-30 15:03:25 +00:00
<p>A <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt6" class="mw-ref reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-2"}}'><a href="./Parser_test#cite_note-x-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
C <sup about="#mwt9" class="mw-ref reference" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"y"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-y-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li><li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Parser_test#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li><li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Parser_test#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-1"}}'><a href="./Parser_test#cite_note-x-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"},"body":{"id":"mw-reference-text-cite_note-x-1"}}'><a href="./Parser_test#cite_note-x-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref reference" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
C <sup about="#mwt6" class="mw-ref reference" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="./Parser_test#cite_note-x-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></supn></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Parser_test#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"constructor"},"body":{"id":"mw-reference-text-cite_note-constructor-1"}}'><a href="./Parser_test#cite_note-constructor-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Parser_test#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 5. body should accept generic wikitext
!! wikitext
A <ref>
2020-05-07 17:11:52 +00:00
This is a '''[[bolded link]]''' and this is a {{1x|transclusion}}
2017-02-22 17:21:47 +00:00
</ref>
<references />
!! html/parsoid
2023-02-09 21:58:10 +00:00
<p>A <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2023-02-09 21:58:10 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">
This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link" data-parsoid='{"stx":"simple","a":{"href":"./Bolded_link"},"sa":{"href":"bolded link"}}'>bolded link</a></b> and this is a <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 6. indent-pres should not be output in ref-body
!! wikitext
A <ref>
foo
bar
baz
</ref>
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">
2018-08-17 19:39:13 +00:00
foo
2017-02-22 17:21:47 +00:00
bar
baz
</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 7. No p-wrapping in ref-body
!! wikitext
A <ref>
foo
bar
baz
booz
</ref>
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">
2018-08-17 19:39:13 +00:00
foo
2017-02-22 17:21:47 +00:00
bar
baz
booz
</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 8. transclusion wikitext has lower precedence
!! wikitext
2020-05-07 17:11:52 +00:00
A <ref> foo {{1x|</ref> B C}}
2017-02-22 17:21:47 +00:00
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> B C}}</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2020-05-07 17:11:52 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"> foo {{1x|</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 9. unclosed comments should not leak out of ref-body
!! wikitext
A <ref> foo <!--</ref> B C
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> B C</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"> foo <!----></span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 10. Unclosed HTML tags should not leak out of ref-body
!! wikitext
A <ref> <b> foo </ref> B C
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> B C</p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> B
C <sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup> D</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 12. ref-tags act as trailing newline migration barrier
!! wikitext
<!--the newline at the end of this line moves out of the p tag-->a
2020-07-15 15:39:36 +00:00
b<!--the newline at the end of this line stays inside the p tag--> <ref>foo</ref>
<ref>bar</ref>
2017-02-22 17:21:47 +00:00
c
<references />
!! html/parsoid
<!--the newline at the end of this line moves out of the p tag--><p>a</p>
2022-04-14 06:33:01 +00:00
<p>b<!--the newline at the end of this line stays inside the p tag--> <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
<p>c</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2020-07-15 15:39:36 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> A
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup> B</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
2017-02-22 17:21:47 +00:00
</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> baz</ref></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <ref>bar</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A1 <sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> A2 <sup about="#mwt4" class="mw-ref reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B1 <sup about="#mwt7" class="mw-ref reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="./Parser_test#cite_note-b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup> B2 <sup about="#mwt8" class="mw-ref reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"},"body":{"id":"mw-reference-text-cite_note-b-2"}}'><a href="./Parser_test#cite_note-b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a b"},"body":{"id":"mw-reference-text-cite_note-a_b-1"}}'><a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":":0"},"body":{"id":"mw-reference-text-cite_note-:0-2"}}'><a href="./Parser_test#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Parser_test#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Parser_test#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
Ref: 18. T58916: Extension attributes should be parsed as plain text
2017-09-18 19:17:06 +00:00
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5", "legacy" ]
2017-02-22 17:21:47 +00:00
!! wikitext
2020-05-07 17:11:52 +00:00
<ref name="{{1x|a}}">foo</ref>
2017-02-22 17:21:47 +00:00
<references />
2017-09-18 19:17:06 +00:00
!! html/php
2020-05-07 17:11:52 +00:00
<p><sup id="cite_ref-{{1x|a}}_1-0" class="reference"><a href="#cite_note-{{1x|a}}-1">[1]</a></sup>
2017-09-18 19:17:06 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2020-05-07 17:11:52 +00:00
<li id="cite_note-{{1x|a}}-1"><span class="mw-cite-backlink"><a href="#cite_ref-{{1x|a}}_1-0">↑</a></span> <span class="reference-text">foo</span>
2017-09-18 19:17:06 +00:00
</li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! html/parsoid
2022-05-11 23:08:15 +00:00
<p><sup about="#mwt1" class="mw-ref reference" id="cite_ref-{{1x|a}}_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"{{1x|a}}"},"body":{"id":"mw-reference-text-cite_note-{{1x|a}}-1"}}'><a href="./Parser_test#cite_note-{{1x|a}}-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2017-02-22 17:21:47 +00:00
</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2020-05-07 17:11:52 +00:00
<li about="#cite_ref-{{1x|a}}_1-1" id="cite_note-{{1x|a}}-1"><a href="./Parser_test#cite_ref-{{1x|a}}_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-{{1x|a}}-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
2018-03-07 07:23:31 +00:00
# Parsoid doesn't wt2wt this cleanly because we serialize both
# versions of the name the same way ("a & b")
2017-02-22 17:21:47 +00:00
!! test
Ref: 19. ref-tags with identical name encodings should get identical indexes
2018-03-07 07:23:31 +00:00
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5", "legacy" ]
2018-03-07 07:23:31 +00:00
!! options
parsoid=wt2html,html2html
2017-02-22 17:21:47 +00:00
!! wikitext
1 <ref name="a & b">foo</ref> 2 <ref name="a & b" />
<references />
2018-03-07 07:23:31 +00:00
!! html/php
<p>1 <sup id="cite_ref-a_&_b_1-0" class="reference"><a href="#cite_note-a_&_b-1">[1]</a></sup> 2 <sup id="cite_ref-a_&_b_1-1" class="reference"><a href="#cite_note-a_&_b-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a_&_b-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_&_b_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_&_b_1-1">1.1</a></sup></span> <span class="reference-text">foo</span>
</li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>1 <sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_&_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a & b"},"body":{"id":"mw-reference-text-cite_note-a_&_b-1"}}'><a href="./Parser_test#cite_note-a_&_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> 2 <sup about="#mwt4" class="mw-ref reference" id="cite_ref-a_&_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a & b"}}'><a href="./Parser_test#cite_note-a_&_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2017-02-22 17:21:47 +00:00
</p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="cite_note-a_&_b-1" id="cite_note-a_&_b-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_&_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_&_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_&_b-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"},"body":{"id":"mw-reference-text-cite_note-foo-1"}}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2021-07-30 15:03:25 +00:00
B <sup about="#mwt6" class="mw-ref reference" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"foo"},"body":{"html":"Foo two"},"errors":[{"key":"cite_error_references_duplicate_key","params":["foo"]}]}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
2022-04-14 06:33:01 +00:00
C <sup about="#mwt6" class="mw-ref reference" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Parser_test#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
2021-07-30 15:03:25 +00:00
!! test
Verify invalid use of a numeric character in a ref name
!! wikitext
PRE <ref>preValue</ref>
THEVALUE <ref name="1">theValue</ref>
POST <ref>postValue</ref>
<references />
!! html/php
<p>PRE <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
THEVALUE <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name cannot be a simple integer. Use a descriptive title</span>
POST <sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">preValue</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">postValue</span>
</li>
</ol></div>
!! html/parsoid
<p>PRE <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
THEVALUE <sup about="#mwt4" class="mw-ref reference" id="cite_ref-1_2-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"1"},"body":{"id":"mw-reference-text-cite_note-1-2"},"errors":[{"key":"cite_error_ref_numeric_key"}]}'><a href="./Parser_test#cite_note-1-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
POST <sup about="#mwt6" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">preValue</span></li><li about="#cite_note-1-2" id="cite_note-1-2"><a href="./Parser_test#cite_ref-1_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1-2" class="mw-reference-text">theValue</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">postValue</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Verify invalid use of a numeric character in a ref name and follow
!! wikitext
<ref name="1">theValue</ref>
<ref follow="1">theFollow</ref>
<references />
!! html/php
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name cannot be a simple integer. Use a descriptive title</span>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name cannot be a simple integer. Use a descriptive title</span>
</p>
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"1"},"body":{"id":"mw-reference-text-cite_note-1-1"},"errors":[{"key":"cite_error_ref_numeric_key"}]}'><a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"follow":"1"},"body":{"id":"mw-reference-text-cite_note-1-1"}}'><a href="./Parser_test#cite_note-1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1-1" id="cite_note-1-1"><a href="./Parser_test#cite_ref-1_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1-1" class="mw-reference-text">theValue<span typeof="mw:Cite/Follow" about="#mwt4"> theFollow</span></span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
2017-02-22 17:21:47 +00:00
!! test
2018-08-17 19:39:13 +00:00
References: 1a. references tag without any refs should be handled properly
2017-02-22 17:21:47 +00:00
!! wikitext
<references />
!! html/parsoid
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div>
2017-02-22 17:21:47 +00:00
!! end
2018-08-17 19:39:13 +00:00
!! test
References: 1b. references tag without any refs should be handled properly
!! wikitext
<references></references>
!! html/parsoid
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{},"body":{"html":""}}'><ol class="mw-references references"></ol></div>
2018-08-17 19:39:13 +00:00
!! end
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></sup>
C <sup class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{"group":"a"}}'><ol class="mw-references references" data-mw-group="a">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt12" data-mw='{"name":"references","attrs":{"group":"b"}}'><ol class="mw-references references" data-mw-group="b">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
References: 3. ref list should be cleared after processing references
!! wikitext
A <ref>foo</ref>
<references />
B <ref>bar</ref>
<references />
2019-12-02 09:10:06 +00:00
!! html
<p>A <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
<p>B <sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">bar</span>
</li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
2022-04-14 06:33:01 +00:00
<p>B <sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
2019-12-02 09:10:06 +00:00
!! test
Counters should be cleared after processing named <references group="…">
!! wikitext
A <ref group="g">foo</ref>
<references group="g" />
B <ref group="g">bar</ref>
<references group="g" />
!! html
<p>A <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[g 1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
<p>B <sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[g 1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">bar</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"g"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="g"><span class="mw-reflink-text">[g 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{"group":"g"}}'><ol class="mw-references references" data-mw-group="g"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
<p>B <sup about="#mwt7" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"g"},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="g"><span class="mw-reflink-text">[g 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{"group":"g"}}'><ol class="mw-references references" data-mw-group="g"><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li></ol></div>
2019-12-02 09:10:06 +00:00
!! end
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><ol class="mw-references references" data-mw-group="a"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
2022-04-14 06:33:01 +00:00
<p>C <sup about="#mwt8" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2022-04-14 06:33:01 +00:00
<p>A <sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt4" class="mw-ref reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"},"body":{"id":"mw-reference-text-cite_note-b-2"}}'><a href="./Parser_test#cite_note-b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt8\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[59,82,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\"},\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"}}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Parser_test#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
References: 6. <references /> from a transclusion
!! wikitext
2020-05-07 17:11:52 +00:00
<ref>Foo</ref> {{1x|<references />}}
2021-09-30 20:00:56 +00:00
!! html/php
2018-08-17 19:39:13 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup> </p><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Foo</span>
</li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! html/parsoid
2022-04-14 08:06:50 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> </p><div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt3" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li></ol></div>
2018-08-17 19:39:13 +00:00
2017-02-22 17:21:47 +00:00
!! 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
2021-07-30 15:03:25 +00:00
<p>A <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
B <sup about="#mwt6" class="mw-ref reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="./Parser_test#cite_note-b-2" style="counter-reset: mw-Ref 1;" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li></ol></div>
2017-02-22 17:21:47 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n<sup about=\"#mwt13\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[96,119,14,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"b\"},\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"}}'><a href=\"./Parser_test#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\"><span class=\"mw-reflink-text\">[X 1]</span></a></sup>\n"}}'><ol class="mw-references references" data-mw-group="X"><li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Parser_test#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li></ol></div>
2020-07-15 15:39:36 +00:00
!! end
!! test
References: 7b. Multiple references tags some with errors should be correctly handled
!! wikitext
ALPHA<ref name="foo" />
BETA<ref name="foo" />
ONE<ref group="NOTES" name="foo" />
TWO<ref group="NOTES" name="foo">food</ref>
<references group="NOTES" />
<references />
THREE<ref group="NOTES" name="bar">CONTENT</ref>
FOUR<ref group="NOTES" name="foo" />
FIVE<ref group="NOTES" name="foo" />
SIX<ref name="foo" />
<references group="NOTES" />
<references>
<ref name="foo">NOGROUPCONTENT</ref>
</references>
SEVEN<ref group="NOTES" name="bar" />
EIGHT<ref group="NOTES" name="foo" />
<references group="NOTES" />
NINE<ref group="NOTES" name="bar">NINECONTENT</ref>
TEN<ref group="NOTES" name="foo">TENCONTENT</ref>
<references group="NOTES" />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>ALPHA<sup about="#mwt3" class="mw-ref reference" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
BETA<sup about="#mwt6" class="mw-ref reference" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
ONE<sup about="#mwt9" class="mw-ref reference" id="cite_ref-foo_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"}}'><a href="./Parser_test#cite_note-foo-2" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup>
TWO<sup about="#mwt12" class="mw-ref reference" id="cite_ref-foo_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"body":{"id":"mw-reference-text-cite_note-foo-2"}}'><a href="./Parser_test#cite_note-foo-2" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-mw='{"name":"references","attrs":{"group":"NOTES"}}'><ol class="mw-references references" data-mw-group="NOTES"><li about="#cite_note-foo-2" id="cite_note-foo-2"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-foo_2-0" data-mw-group="NOTES"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-foo_2-1" data-mw-group="NOTES"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-foo-2" class="mw-reference-text">food</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt18" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text"></span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p>THREE<sup about="#mwt21" class="mw-ref reference" id="cite_ref-bar_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"bar"},"body":{"id":"mw-reference-text-cite_note-bar-3"}}'><a href="./Parser_test#cite_note-bar-3" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup>
FOUR<sup about="#mwt24" class="mw-ref reference" id="cite_ref-foo_4-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-4" style="counter-reset: mw-Ref 2;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 2]</span></a></sup>
FIVE<sup about="#mwt27" class="mw-ref reference" id="cite_ref-foo_4-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-4" style="counter-reset: mw-Ref 2;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 2]</span></a></sup>
SIX<sup about="#mwt30" class="mw-ref reference" id="cite_ref-foo_5-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="./Parser_test#cite_note-foo-5" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt33" data-mw='{"name":"references","attrs":{"group":"NOTES"}}'><ol class="mw-references references" data-mw-group="NOTES"><li about="#cite_note-bar-3" id="cite_note-bar-3"><a href="./Parser_test#cite_ref-bar_3-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-bar-3" class="mw-reference-text">CONTENT</span></li><li about="#cite_note-foo-4" id="cite_note-foo-4"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-foo_4-0" data-mw-group="NOTES"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-foo_4-1" data-mw-group="NOTES"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-foo-4" class="mw-reference-text"></span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt39" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt37\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[398,434,16,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\"},\"body\":{\"id\":\"mw-reference-text-cite_note-foo-5\"}}'><a href=\"./Parser_test#cite_note-foo-5\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-foo-5" id="cite_note-foo-5"><a href="./Parser_test#cite_ref-foo_5-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-5" class="mw-reference-text">NOGROUPCONTENT</span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p>SEVEN<sup about="#mwt42" class="mw-ref reference" id="cite_ref-bar_6-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"bar"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-bar-6" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup>
EIGHT<sup about="#mwt45" class="mw-ref reference" id="cite_ref-foo_7-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"errors":[{"key":"cite_error_references_no_text"}]}'><a href="./Parser_test#cite_note-foo-7" style="counter-reset: mw-Ref 2;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt48" data-mw='{"name":"references","attrs":{"group":"NOTES"}}'><ol class="mw-references references" data-mw-group="NOTES"><li about="#cite_note-bar-6" id="cite_note-bar-6"><a href="./Parser_test#cite_ref-bar_6-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-bar-6" class="mw-reference-text"></span></li><li about="#cite_note-foo-7" id="cite_note-foo-7"><a href="./Parser_test#cite_ref-foo_7-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-7" class="mw-reference-text"></span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p>NINE<sup about="#mwt51" class="mw-ref reference" id="cite_ref-bar_8-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"bar"},"body":{"id":"mw-reference-text-cite_note-bar-8"}}'><a href="./Parser_test#cite_note-bar-8" style="counter-reset: mw-Ref 1;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 1]</span></a></sup>
TEN<sup about="#mwt54" class="mw-ref reference" id="cite_ref-foo_9-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"NOTES","name":"foo"},"body":{"id":"mw-reference-text-cite_note-foo-9"}}'><a href="./Parser_test#cite_note-foo-9" style="counter-reset: mw-Ref 2;" data-mw-group="NOTES"><span class="mw-reflink-text">[NOTES 2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt57" data-mw='{"name":"references","attrs":{"group":"NOTES"}}'><ol class="mw-references references" data-mw-group="NOTES"><li about="#cite_note-bar-8" id="cite_note-bar-8"><a href="./Parser_test#cite_ref-bar_8-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-bar-8" class="mw-reference-text">NINECONTENT</span></li><li about="#cite_note-foo-9" id="cite_note-foo-9"><a href="./Parser_test#cite_ref-foo_9-0" data-mw-group="NOTES" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-foo-9" class="mw-reference-text">TENCONTENT</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
!! wikitext
2020-05-07 17:11:52 +00:00
X{{1x|<ref>foo {{1x|<b>bar</b>}} and {{1x|baz}} boo</ref>}}
2017-02-22 17:21:47 +00:00
<references />
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p>X<sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<ref>foo {{1x|<b>bar</b>}} and {{1x|baz}} boo</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
References: 9. Generate missing references list at the end
!! wikitext
A <ref>foo</ref>
B <ref group="inexistent">bar</ref>
!! html/parsoid
2022-05-11 23:08:15 +00:00
<p>A <sup about="#mwt1" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> B <sup class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"inexistent"},"body":{"id":"mw-reference-text-cite_note-2"},"errors":[{"key":"cite_error_group_refs_without_references","params":["inexistent"]}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 1;" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'><ol class="mw-references references" data-mw-group="inexistent">
2019-01-02 17:31:42 +00:00
<li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
2018-03-07 07:23:31 +00:00
References: 10.1. New <references/> shouldn't be added for unrelated edits.
2017-02-22 17:21:47 +00:00
!! options
parsoid={
"modes": ["selser"],
"changes": [["#x", "remove"]],
"selser": "noauto"
}
!! wikitext
Unrelated text<span id="x"> that's going to disappear</span>.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end
2018-03-07 07:23:31 +00:00
!! test
References: 10.2. New <references/> shouldn't be added for unrelated edits.
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=2
2018-03-07 07:23:31 +00:00
!! options
parsoid={
"modes": ["selser"],
"changes": [["#x", "remove"]],
2022-05-11 23:08:15 +00:00
"selser": "noauto"
2018-03-07 07:23:31 +00:00
}
!! wikitext
Unrelated text<span id="x"> that's going to disappear</span>.
A <ref>foo</ref>
!! wikitext/edited
Unrelated text.
A <ref>foo</ref>
!! end
2021-07-30 15:03:25 +00:00
!! test
Grouped references with follow rendered in mixed order
!! wikitext
2023-02-28 15:50:24 +00:00
AA<ref group="a" name="name_a">group_a_name_a</ref>
BA<ref group="b" name="name_a">group_b_name_a</ref>
CA<ref group="c" name="name_a">group_c_name_a</ref>
BB<ref group="b" name="name_b">group_b_name_b</ref>
FBA<ref group="b" follow="name_a">group_b_follow_a</ref>
FAA<ref group="a" follow="name_a">group_a_follow_a</ref>
FBB<ref group="b" follow="name_b">group_b_follow_b</ref>
FCA<ref group="c" follow="name_a">group_c_follow_a</ref>
2021-07-30 15:03:25 +00:00
<references group="b" />
<references group="c" />
<references group="a" />
!! html/php
2023-02-28 15:50:24 +00:00
<p>AA<sup id="cite_ref-name_a_1-0" class="reference"><a href="#cite_note-name_a-1">[a 1]</a></sup>
BA<sup id="cite_ref-name_a_2-0" class="reference"><a href="#cite_note-name_a-2">[b 1]</a></sup>
CA<sup id="cite_ref-name_a_3-0" class="reference"><a href="#cite_note-name_a-3">[c 1]</a></sup>
BB<sup id="cite_ref-name_b_4-0" class="reference"><a href="#cite_note-name_b-4">[b 2]</a></sup>
FBA
FAA
FBB
FCA
2021-07-30 15:03:25 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-name_a-2"><span class="mw-cite-backlink"><a href="#cite_ref-name_a_2-0">↑</a></span> <span class="reference-text">group_b_name_a group_b_follow_a</span>
</li>
<li id="cite_note-name_b-4"><span class="mw-cite-backlink"><a href="#cite_ref-name_b_4-0">↑</a></span> <span class="reference-text">group_b_name_b group_b_follow_b</span>
</li>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-name_a-3"><span class="mw-cite-backlink"><a href="#cite_ref-name_a_3-0">↑</a></span> <span class="reference-text">group_c_name_a group_c_follow_a</span>
</li>
</ol></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-name_a-1"><span class="mw-cite-backlink"><a href="#cite_ref-name_a_1-0">↑</a></span> <span class="reference-text">group_a_name_a group_a_follow_a</span>
</li>
</ol></div>
!! html/parsoid
2023-02-28 15:50:24 +00:00
<p>AA<sup about="#mwt2" class="mw-ref reference" id="cite_ref-name_a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a","name":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-1"}}'><a href="./Parser_test#cite_note-name_a-1" style="counter-reset: mw-Ref 1;" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
BA<sup about="#mwt4" class="mw-ref reference" id="cite_ref-name_a_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b","name":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-2"}}'><a href="./Parser_test#cite_note-name_a-2" style="counter-reset: mw-Ref 1;" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></sup>
CA<sup about="#mwt6" class="mw-ref reference" id="cite_ref-name_a_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"c","name":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-3"}}'><a href="./Parser_test#cite_note-name_a-3" style="counter-reset: mw-Ref 1;" data-mw-group="c"><span class="mw-reflink-text">[c 1]</span></a></sup>
BB<sup about="#mwt8" class="mw-ref reference" id="cite_ref-name_b_4-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b","name":"name_b"},"body":{"id":"mw-reference-text-cite_note-name_b-4"}}'><a href="./Parser_test#cite_note-name_b-4" style="counter-reset: mw-Ref 2;" data-mw-group="b"><span class="mw-reflink-text">[b 2]</span></a></sup>
FBA<sup about="#mwt10" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b","follow":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-2"}}'><a href="./Parser_test#cite_note-name_a-2" style="counter-reset: mw-Ref 1;" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></sup>
FAA<sup about="#mwt12" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"a","follow":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-1"}}'><a href="./Parser_test#cite_note-name_a-1" style="counter-reset: mw-Ref 1;" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></sup>
FBB<sup about="#mwt14" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"b","follow":"name_b"},"body":{"id":"mw-reference-text-cite_note-name_b-4"}}'><a href="./Parser_test#cite_note-name_b-4" style="counter-reset: mw-Ref 2;" data-mw-group="b"><span class="mw-reflink-text">[b 2]</span></a></sup>
FCA<sup about="#mwt16" class="mw-ref reference mw-ref-follow" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"c","follow":"name_a"},"body":{"id":"mw-reference-text-cite_note-name_a-3"}}'><a href="./Parser_test#cite_note-name_a-3" style="counter-reset: mw-Ref 1;" data-mw-group="c"><span class="mw-reflink-text">[c 1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt18" data-mw='{"name":"references","attrs":{"group":"b"}}'><ol class="mw-references references" data-mw-group="b"><li about="#cite_note-name_a-2" id="cite_note-name_a-2"><a href="./Parser_test#cite_ref-name_a_2-0" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-name_a-2" class="mw-reference-text">group_b_name_a<span typeof="mw:Cite/Follow" about="#mwt10"> group_b_follow_a</span></span></li><li about="#cite_note-name_b-4" id="cite_note-name_b-4"><a href="./Parser_test#cite_ref-name_b_4-0" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-name_b-4" class="mw-reference-text">group_b_name_b<span typeof="mw:Cite/Follow" about="#mwt14"> group_b_follow_b</span></span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt20" data-mw='{"name":"references","attrs":{"group":"c"}}'><ol class="mw-references references" data-mw-group="c"><li about="#cite_note-name_a-3" id="cite_note-name_a-3"><a href="./Parser_test#cite_ref-name_a_3-0" data-mw-group="c" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-name_a-3" class="mw-reference-text">group_c_name_a<span typeof="mw:Cite/Follow" about="#mwt16"> group_c_follow_a</span></span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt22" data-mw='{"name":"references","attrs":{"group":"a"}}'><ol class="mw-references references" data-mw-group="a"><li about="#cite_note-name_a-1" id="cite_note-name_a-1"><a href="./Parser_test#cite_ref-name_a_1-0" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-name_a-1" class="mw-reference-text">group_a_name_a<span typeof="mw:Cite/Follow" about="#mwt12"> group_a_follow_a</span></span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Grouped references with automatic group references generating errors
!! wikitext
GROUP <ref group="theGroup" name="theName">theValue</ref>
GROUP3 <ref group="theGroup3" name="theName3">theValue3</ref>
GROUP2 <ref group="theGroup2" name="theName2">theValue2</ref>
aDifferentNameGROUP3 <ref group="theGroup3" name="theName">anotherValue3differentName</ref>
aDifferentNameGROUP2 <ref group="theGroup2" name="anotherName2">anotherValue2DifferentName</ref>
anotherGROUP3 <ref group="theGroup3" name="theName3">anotherValue3</ref>
aDifferentNameGROUP <ref group="theGroup" name="anotherName2">anotherValueDifferentName</ref>
<references group="theGroup3" />
!! html/php
<p>GROUP <sup id="cite_ref-theName_1-0" class="reference"><a href="#cite_note-theName-1">[theGroup 1]</a></sup>
GROUP3 <sup id="cite_ref-theName3_2-0" class="reference"><a href="#cite_note-theName3-2">[theGroup3 1]</a></sup>
GROUP2 <sup id="cite_ref-theName2_3-0" class="reference"><a href="#cite_note-theName2-3">[theGroup2 1]</a></sup>
aDifferentNameGROUP3 <sup id="cite_ref-theName_4-0" class="reference"><a href="#cite_note-theName-4">[theGroup3 2]</a></sup>
aDifferentNameGROUP2 <sup id="cite_ref-anotherName2_5-0" class="reference"><a href="#cite_note-anotherName2-5">[theGroup2 2]</a></sup>
anotherGROUP3 <sup id="cite_ref-theName3_2-1" class="reference"><a href="#cite_note-theName3-2">[theGroup3 1]</a></sup>
aDifferentNameGROUP <sup id="cite_ref-anotherName2_6-0" class="reference"><a href="#cite_note-anotherName2-6">[theGroup 2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-theName3-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-theName3_2-0">1.0</a></sup> <sup><a href="#cite_ref-theName3_2-1">1.1</a></sup></span> <span class="reference-text">theValue3 <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "theName3" defined multiple times with different content</span></span>
</li>
<li id="cite_note-theName-4"><span class="mw-cite-backlink"><a href="#cite_ref-theName_4-0">↑</a></span> <span class="reference-text">anotherValue3differentName</span>
</li>
</ol></div>
<p><br /><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tags exist for a group named "theGroup", but no corresponding <code><references group="theGroup"/></code> tag was found</span><br /><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tags exist for a group named "theGroup2", but no corresponding <code><references group="theGroup2"/></code> tag was found</span>
</p>
!! html/parsoid
<p>GROUP <sup about="#mwt2" class="mw-ref reference" id="cite_ref-theName_1-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"theGroup","name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-1"},"errors":[{"key":"cite_error_group_refs_without_references","params":["theGroup"]}]}'><a href="./Parser_test#cite_note-theName-1" style="counter-reset: mw-Ref 1;" data-mw-group="theGroup"><span class="mw-reflink-text">[theGroup 1]</span></a></sup>
GROUP3 <sup about="#mwt4" class="mw-ref reference" id="cite_ref-theName3_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"theGroup3","name":"theName3"},"body":{"id":"mw-reference-text-cite_note-theName3-2"}}'><a href="./Parser_test#cite_note-theName3-2" style="counter-reset: mw-Ref 1;" data-mw-group="theGroup3"><span class="mw-reflink-text">[theGroup3 1]</span></a></sup>
GROUP2 <sup about="#mwt6" class="mw-ref reference" id="cite_ref-theName2_3-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"theGroup2","name":"theName2"},"body":{"id":"mw-reference-text-cite_note-theName2-3"},"errors":[{"key":"cite_error_group_refs_without_references","params":["theGroup2"]}]}'><a href="./Parser_test#cite_note-theName2-3" style="counter-reset: mw-Ref 1;" data-mw-group="theGroup2"><span class="mw-reflink-text">[theGroup2 1]</span></a></sup>
aDifferentNameGROUP3 <sup about="#mwt8" class="mw-ref reference" id="cite_ref-theName_4-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"theGroup3","name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-4"}}'><a href="./Parser_test#cite_note-theName-4" style="counter-reset: mw-Ref 2;" data-mw-group="theGroup3"><span class="mw-reflink-text">[theGroup3 2]</span></a></sup>
aDifferentNameGROUP2 <sup about="#mwt10" class="mw-ref reference" id="cite_ref-anotherName2_5-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"theGroup2","name":"anotherName2"},"body":{"id":"mw-reference-text-cite_note-anotherName2-5"},"errors":[{"key":"cite_error_group_refs_without_references","params":["theGroup2"]}]}'><a href="./Parser_test#cite_note-anotherName2-5" style="counter-reset: mw-Ref 2;" data-mw-group="theGroup2"><span class="mw-reflink-text">[theGroup2 2]</span></a></sup>
anotherGROUP3 <sup about="#mwt12" class="mw-ref reference" id="cite_ref-theName3_2-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"theGroup3","name":"theName3"},"body":{"html":"anotherValue3"},"errors":[{"key":"cite_error_references_duplicate_key","params":["theName3"]}]}'><a href="./Parser_test#cite_note-theName3-2" style="counter-reset: mw-Ref 1;" data-mw-group="theGroup3"><span class="mw-reflink-text">[theGroup3 1]</span></a></sup>
aDifferentNameGROUP <sup about="#mwt14" class="mw-ref reference" id="cite_ref-anotherName2_6-0" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"group":"theGroup","name":"anotherName2"},"body":{"id":"mw-reference-text-cite_note-anotherName2-6"},"errors":[{"key":"cite_error_group_refs_without_references","params":["theGroup"]}]}'><a href="./Parser_test#cite_note-anotherName2-6" style="counter-reset: mw-Ref 2;" data-mw-group="theGroup"><span class="mw-reflink-text">[theGroup 2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt16" data-parsoid='{"group":"theGroup3"}' data-mw='{"name":"references","attrs":{"group":"theGroup3"}}'><ol class="mw-references references" data-mw-group="theGroup3"><li about="#cite_note-theName3-2" id="cite_note-theName3-2"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-theName3_2-0" data-mw-group="theGroup3"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-theName3_2-1" data-mw-group="theGroup3"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-theName3-2" class="mw-reference-text">theValue3</span></li><li about="#cite_note-theName-4" id="cite_note-theName-4"><a href="./Parser_test#cite_ref-theName_4-0" data-mw-group="theGroup3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-4" class="mw-reference-text">anotherValue3differentName</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt17" data-parsoid='{"group":"theGroup"}' data-mw='{"name":"references","attrs":{"group":"theGroup"},"autoGenerated":true}'><ol class="mw-references references" data-mw-group="theGroup"><li about="#cite_note-theName-1" id="cite_note-theName-1"><a href="./Parser_test#cite_ref-theName_1-0" data-mw-group="theGroup" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-1" class="mw-reference-text">theValue</span></li><li about="#cite_note-anotherName2-6" id="cite_note-anotherName2-6"><a href="./Parser_test#cite_ref-anotherName2_6-0" data-mw-group="theGroup" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-anotherName2-6" class="mw-reference-text">anotherValueDifferentName</span></li></ol></div>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt18" data-parsoid='{"group":"theGroup2"}' data-mw='{"name":"references","attrs":{"group":"theGroup2"},"autoGenerated":true}'><ol class="mw-references references" data-mw-group="theGroup2"><li about="#cite_note-theName2-3" id="cite_note-theName2-3"><a href="./Parser_test#cite_ref-theName2_3-0" data-mw-group="theGroup2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName2-3" class="mw-reference-text">theValue2</span></li><li about="#cite_note-anotherName2-5" id="cite_note-anotherName2-5"><a href="./Parser_test#cite_ref-anotherName2_5-0" data-mw-group="theGroup2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-anotherName2-5" class="mw-reference-text">anotherValue2DifferentName</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
2018-03-07 07:23:31 +00:00
# Doesn't wt2wt cleanly because we don't encode the & in html2wt direction
2017-02-22 17:21:47 +00:00
!! test
Entities in ref name
2018-03-07 07:23:31 +00:00
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5", "legacy" ]
2018-03-07 07:23:31 +00:00
!! options
parsoid=wt2html,html2html
2017-02-22 17:21:47 +00:00
!! wikitext
2020-05-07 17:11:52 +00:00
<ref name="test & me {{1x|foo}}">hi</ref>
2017-02-22 17:21:47 +00:00
<references />
2018-03-07 07:23:31 +00:00
!! html/php
2020-05-07 17:11:52 +00:00
<p><sup id="cite_ref-test_&_me_{{1x|foo}}_1-0" class="reference"><a href="#cite_note-test_&_me_{{1x|foo}}-1">[1]</a></sup>
2018-03-07 07:23:31 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
2020-05-07 17:11:52 +00:00
<li id="cite_note-test_&_me_{{1x|foo}}-1"><span class="mw-cite-backlink"><a href="#cite_ref-test_&_me_{{1x|foo}}_1-0">↑</a></span> <span class="reference-text">hi</span>
2018-03-07 07:23:31 +00:00
</li>
</ol></div>
2017-02-22 17:21:47 +00:00
!! html/parsoid
2022-04-14 06:33:01 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-test_&_me_{{1x|foo}}_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"test & me {{1x|foo}}"},"body":{"id":"mw-reference-text-cite_note-test_&_me_{{1x|foo}}-1"}}'><a href="./Parser_test#cite_note-test_&_me_{{1x|foo}}-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
2020-05-07 17:11:52 +00:00
<li about="#cite_note-test_&_me_{{1x|foo}}-1" id="cite_note-test_&_me_{{1x|foo}}-1"><a href="./Parser_test#cite_ref-test_&_me_{{1x|foo}}_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_&_me_{{1x|foo}}-1" class="mw-reference-text">hi</span></li>
2022-04-14 08:06:50 +00:00
</ol></div>
2017-02-22 17:21:47 +00:00
!! 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
2021-07-30 15:03:25 +00:00
## nowiki tags.
2017-02-22 17:21:47 +00:00
!! test
Generate references for unclosed references tag
!! options
parsoid=wt2html
!! wikitext
a<ref>foo</ref>
<references>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>a<sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-02-22 17:21:47 +00:00
<p><references></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2017-02-22 17:21:47 +00:00
!! end
!! test
New reference serializes on its own line
!! options
parsoid=wt2wt,html2wt
!! wikitext
foo
<references />
!! html/parsoid
2022-04-14 08:06:50 +00:00
foo<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"></ol></div>
2017-02-22 17:21:47 +00:00
!! end
2017-11-21 22:25:25 +00:00
2021-07-30 15:03:25 +00:00
## Ref in ref
## The preprocessor doesn't support nested extension tags. Extensions, for
## their part, can treat portions of their content as wikitext and thus sneak
## in some nesting, the details of which are going to be extension specific.
## However, the common factor is the need to play games with transclusions
## to get around the limitations posed by the preprocessor.
## The legacy implementation only parses the ref contents when producing the
## output for reference tags, at which point, any nested refs will be ignored.
## Parsoid mimics this behaviour.
2017-11-21 22:25:25 +00:00
!! test
2021-07-30 15:03:25 +00:00
Ref in ref: nested in top level ref
2017-11-21 22:25:25 +00:00
!! wikitext
2021-07-30 15:03:25 +00:00
test <ref>hi {{refinref|ho}}</ref>
2017-11-21 22:25:25 +00:00
<references />
2018-03-07 07:23:31 +00:00
!! html/php
<p>test <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">hi </span>
</li>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> has no name attribute.</span>
</p>
2017-11-21 22:25:25 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>test <sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">hi <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"refinref","href":"./Template:Refinref"},"params":{"1":{"wt":"ho"}},"i":0}}]}'></span></span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Ref in ref: top level ref nested in transclusion
!! wikitext
test {{refinref|456<ref>123</ref>}}
<references />
!! html/php
<p>test <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">{{{1}}}</span>
</li>
</ol></div>
!! html/parsoid
2022-05-11 23:08:15 +00:00
<p>test <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"refinref","href":"./Template:Refinref"},"params":{"1":{"wt":"456<ref>123</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references">
<li id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">{{{1}}}</span></li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! end
## This is the common way that wikis use nested references. The reference
## in the arguments will go through extension substitution before being
## passed to the parser function so, in contrast, it'll already have been
## processed by the time the parser gets to the outer ref's contents.
!! test
Ref in ref: top level ref nested in parser function
!! wikitext
test {{#tag:ref|456<ref>123</ref>}}
<references />
!! html/php
<p>test <sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">123</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">456<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p>test <sup about="#mwt2" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"456<ref>123</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">123</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">456<sup about="#mwt6" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>123</ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></span></li></ol></div>
!! end
2023-02-09 21:58:10 +00:00
!! test
Ref in ref: Multiple levels of nesting in parser function
!! wikitext
one{{#tag:ref|two{{#tag:ref|three<ref>four</ref>}}}}
!! html/php
<p>one<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[3]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">four</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">three<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">two<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup></span>
</li>
</ol></div>
!! html/parsoid+integrated
<p>one<sup class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"two{{#tag:ref|three<ref>four</ref>}}"}},"i":0}}]}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
<ol class="mw-references references">
<li id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">four</span></li>
<li id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">three<sup class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></span></li>
<li id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">two<sup class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></span></li>
</ol>
</div>
!! end
2022-05-11 23:08:15 +00:00
## Parsoid is choosing not to support this.
!! test
Ref in ref: self-referential
!! wikitext
{{#tag:ref|<ref name="x" />|name=x}}
!! html/php
<p><sup id="cite_ref-x_1-1" class="reference"><a href="#cite_note-x-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-x-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-x_1-0">1.0</a></sup> <sup><a href="#cite_ref-x_1-1">1.1</a></sup></span> <span class="reference-text"><sup id="cite_ref-x_1-0" class="reference"><a href="#cite_note-x-1">[1]</a></sup></span>
</li>
</ol></div>
2021-07-30 15:03:25 +00:00
!! end
## Bleh! Only to be used in the below. See above where the legacy parser
## wouldn't stand for this nonsense.
!! article
Template:nestedrefslash
!! text
<ref><ref name="RDEN PRE/1355/2005">three</ref></ref>
!! endarticle
## Just a regression test for Parsoid
!! test
Nested ref with forward slash
!! wikitext
test {{nestedrefslash}}
<references />
!! html/parsoid
2021-09-30 20:00:56 +00:00
<p>test <sup about="#mwt1" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"nestedrefslash","href":"./Template:Nestedrefslash"},"params":{},"i":0}}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-RDEN_PRE/1355/2005-1" id="cite_note-RDEN_PRE/1355/2005-1"><a href="./Parser_test#cite_ref-RDEN_PRE/1355/2005_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-RDEN_PRE/1355/2005-1" class="mw-reference-text">three</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><sup about="#mwt4" class="mw-ref reference" id="cite_ref-RDEN_PRE/1355/2005_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"RDEN PRE/1355/2005"},"body":{"id":"mw-reference-text-cite_note-RDEN_PRE/1355/2005-1"}}'><a href="./Parser_test#cite_note-RDEN_PRE/1355/2005-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></span></li></ol></div>
2017-11-21 22:25:25 +00:00
!! end
2017-10-04 17:18:40 +00:00
## Parsoid responsive references tests
!! test
Responsive references: disabled, autogenerated
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=false
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! options
parsoid={
2022-05-11 23:08:15 +00:00
"modes": ["wt2html"]
2017-10-04 17:18:40 +00:00
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: enabled, autogenerated
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! options
parsoid={
2022-05-11 23:08:15 +00:00
"modes": ["wt2html"]
2017-10-04 17:18:40 +00:00
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: enabled, autogenerated, exceed
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=1
2017-10-04 17:18:40 +00:00
!! options
parsoid={
2022-05-11 23:08:15 +00:00
"modes": ["wt2html"]
2017-10-04 17:18:40 +00:00
}
!! wikitext
Test <ref>1</ref><ref>2</ref>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: disabled
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=false
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: enabled
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: enabled, exceed
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=1
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: disabled, explicit
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=false
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"responsive":""}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: disabled, explicit, exceed
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=false
wgCiteResponsiveReferencesThreshold=1
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="" />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<div class="mw-references-wrap mw-references-columns" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"responsive":""}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: enabled, explicit off
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! wikitext
Test <ref>1</ref><ref>2</ref>
<references responsive="0" />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>Test <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
<ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"responsive":"0"}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">2</span></li></ol>
2017-10-04 17:18:40 +00:00
!! end
!! test
Responsive references: roundtrip templates
2022-05-11 23:08:15 +00:00
!! config
wgCiteResponsiveReferences=true
wgCiteResponsiveReferencesThreshold=2
2017-10-04 17:18:40 +00:00
!! wikitext
test <ref>123</ref>
2020-05-07 17:11:52 +00:00
{{1x|haha<references/>}}
2017-10-04 17:18:40 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>test <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2017-10-04 17:18:40 +00:00
2020-05-07 17:11:52 +00:00
<p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"haha<references/>"}},"i":0}}]}'>haha</p><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">123</span></li></ol></div>
2017-10-04 17:18:40 +00:00
!! end
## End Parsoid responsive references tests
2018-03-07 07:23:31 +00:00
!! article
Template:CircularRef
!! text
<ref>Hi {{CircularRef}}</ref>
!! endarticle
!! test
CircularRef
!! wikitext
<ref>Hi {{CircularRef}}</ref>
<references />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Hi </span>
</li>
</ol></div>
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> has no name attribute.</span>
</p>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Hi <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'></span></span></li></ol></div>
2018-03-07 07:23:31 +00:00
!! end
2012-05-15 18:31:23 +00:00
!! test
2019-01-02 17:31:42 +00:00
T15673: <ref> with direction "rtl"
!! wikitext
2012-05-15 18:31:23 +00:00
<ref dir="rtl">TEST</ref>
<references />
2019-01-02 17:31:42 +00:00
!! html/php
2012-05-15 18:31:23 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2019-01-02 17:31:42 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-rtl"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">TEST</span></li></ol></div>
2012-05-15 18:31:23 +00:00
!! end
!! test
2019-01-02 17:31:42 +00:00
T15673: <ref> with direction "ltr"
!! wikitext
2012-05-15 18:31:23 +00:00
<ref dir="ltr">TEST</ref>
<references />
2019-01-02 17:31:42 +00:00
!! html/php
2012-05-15 18:31:23 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"ltr"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2012-05-15 18:31:23 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-ltr"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">TEST</span></li></ol></div>
2019-01-02 17:31:42 +00:00
!! end
2012-05-15 18:31:23 +00:00
!! test
2019-01-02 17:31:42 +00:00
T15673: <ref> with direction "LTR", keeps upper case
!! wikitext
2012-05-15 18:31:23 +00:00
<ref dir="LTR">TEST</ref>
<references />
2019-01-02 17:31:42 +00:00
!! html/php
2012-05-15 18:31:23 +00:00
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">TEST</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"LTR"},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2012-05-15 18:31:23 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1" class="mw-cite-dir-ltr"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">TEST</span></li></ol></div>
2019-01-02 17:31:42 +00:00
!! end
2012-05-15 18:31:23 +00:00
!! test
2021-07-30 15:03:25 +00:00
T15673: <ref> with direction "nonsense" and "" (empty), strip invalid dir attribute and shows error
2019-01-02 17:31:42 +00:00
!! wikitext
2021-07-30 15:03:25 +00:00
<ref dir="nonsense">NONSENSE_DIR_TEST</ref>
<ref dir="">EMPTY_DIR_TEST</ref>
2012-05-15 18:31:23 +00:00
<references />
2021-07-30 15:03:25 +00:00
!! html/php
2019-12-16 14:33:55 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>dir="nonsense"</code>, must be <code>ltr</code> or <code>rtl</code></span>
2021-07-30 15:03:25 +00:00
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>dir=""</code>, must be <code>ltr</code> or <code>rtl</code></span>
2012-05-15 18:31:23 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"dir":"nonsense"},"body":{"id":"mw-reference-text-cite_note-1"},"errors":[{"key":"cite_error_ref_invalid_dir","params":["nonsense"]}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt4" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref mw:Error" data-mw='{"name":"ref","attrs":{"dir":""},"body":{"id":"mw-reference-text-cite_note-2"},"errors":[{"key":"cite_error_ref_invalid_dir","params":[""]}]}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">NONSENSE_DIR_TEST</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">EMPTY_DIR_TEST</span></li></ol></div>
2019-01-02 17:31:42 +00:00
!! end
2012-05-15 18:31:23 +00:00
!! test
2019-01-02 17:31:42 +00:00
T15673: Direction is supported when specifying name and group
!! wikitext
<ref dir="ltr" name="a" group="note">TEST</ref>
<references group="note" />
!! html/php
2012-05-15 18:31:23 +00:00
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[note 1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1" class="mw-cite-dir-ltr"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">TEST</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt4" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"dir":"ltr","name":"a","group":"note"},"body":{"id":"mw-reference-text-cite_note-a-1"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;" data-mw-group="note"><span class="mw-reflink-text">[note 1]</span></a></sup></p>
2018-08-17 19:39:13 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"note"}}'><ol class="mw-references references" data-mw-group="note"><li about="#cite_note-a-1" id="cite_note-a-1" class="mw-cite-dir-ltr"><a href="./Parser_test#cite_ref-a_1-0" data-mw-group="note" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">TEST</span></li></ol></div>
2019-01-02 17:31:42 +00:00
!! end
2018-08-17 19:39:13 +00:00
## Just to catch regressions in Parsoid's tree-building / p-wrapping
!! test
Ref with block content in formatting tag
!! wikitext
''hi<ref><div>ho</div></ref>''
<references />
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><i>hi<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></i></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><div data-parsoid='{"stx":"html"}'>ho</div></span></li></ol></div>
2018-08-17 19:39:13 +00:00
!! end
2018-08-22 22:27:23 +00:00
!! test
T196827: Use the dir parameter only from the full definition of a named ref tag
!! wikitext
abc<ref name="r1" />def
ghi<ref name="r1" dir="rtl">jkl</ref>mno
<references />
!! html/php
<p>abc<sup id="cite_ref-r1_1-0" class="reference"><a href="#cite_note-r1-1">[1]</a></sup>def
</p><p>ghi<sup id="cite_ref-r1_1-1" class="reference"><a href="#cite_note-r1-1">[1]</a></sup>mno
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-r1-1" class="mw-cite-dir-rtl"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-r1_1-0">1.0</a></sup> <sup><a href="#cite_ref-r1_1-1">1.1</a></sup></span> <span class="reference-text">jkl</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>abc<sup about="#mwt3" class="mw-ref reference" id="cite_ref-r1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>def</p>
2019-01-02 17:31:42 +00:00
2021-07-30 15:03:25 +00:00
<p>ghi<sup about="#mwt6" class="mw-ref reference" id="cite_ref-r1_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1","dir":"rtl"},"body":{"id":"mw-reference-text-cite_note-r1-1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>mno</p>
2019-01-02 17:31:42 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-r1-1" id="cite_note-r1-1" class="mw-cite-dir-rtl"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-r1_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-r1_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-r1-1" class="mw-reference-text">jkl</span></li></ol></div>
2018-08-22 22:27:23 +00:00
!! end
!! test
T196827: Ignore the dir parameter from the first use, which is not a full definition, and use the dir value from the full definition of a named ref tag
!! wikitext
abc<ref name="r1" dir="rtl" />def
ghi<ref name="r1">jkl</ref>mno
<references />
!! html/php
<p>abc<sup id="cite_ref-r1_1-0" class="reference"><a href="#cite_note-r1-1">[1]</a></sup>def
</p><p>ghi<sup id="cite_ref-r1_1-1" class="reference"><a href="#cite_note-r1-1">[1]</a></sup>mno
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-r1-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-r1_1-0">1.0</a></sup> <sup><a href="#cite_ref-r1_1-1">1.1</a></sup></span> <span class="reference-text">jkl</span>
</li>
</ol></div>
2019-01-02 17:31:42 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>abc<sup about="#mwt3" class="mw-ref reference" id="cite_ref-r1_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1","dir":"rtl"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>def</p>
2019-01-02 17:31:42 +00:00
2021-07-30 15:03:25 +00:00
<p>ghi<sup about="#mwt7" class="mw-ref reference" id="cite_ref-r1_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"r1"},"body":{"id":"mw-reference-text-cite_note-r1-1"}}'><a href="./Parser_test#cite_note-r1-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>mno</p>
2019-01-02 17:31:42 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-r1-1" id="cite_note-r1-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-r1_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-r1_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-r1-1" class="mw-reference-text">jkl</span></li></ol></div>
2018-08-22 22:27:23 +00:00
!! end
2019-03-19 15:39:23 +00:00
!! test
Similarly named refs with identical bodies
!! wikitext
2021-07-30 15:03:25 +00:00
1 <ref name="one">1</ref> 2 <ref name="one">1</ref>
2019-03-19 15:39:23 +00:00
<references />
2021-07-30 15:03:25 +00:00
!! html/php
<p>1 <sup id="cite_ref-one_1-0" class="reference"><a href="#cite_note-one-1">[1]</a></sup> 2 <sup id="cite_ref-one_1-1" class="reference"><a href="#cite_note-one-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-one-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-one_1-0">1.0</a></sup> <sup><a href="#cite_ref-one_1-1">1.1</a></sup></span> <span class="reference-text">1</span>
</li>
</ol></div>
2019-03-19 15:39:23 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>1 <sup about="#mwt3" class="mw-ref reference" id="cite_ref-one_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"one"},"body":{"id":"mw-reference-text-cite_note-one-1"}}'><a href="./Parser_test#cite_note-one-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup> 2 <sup about="#mwt4" class="mw-ref reference" id="cite_ref-one_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"one"},"body":{"id":"mw-reference-text-cite_note-one-1"}}'><a href="./Parser_test#cite_note-one-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2019-03-19 15:39:23 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-one-1" id="cite_note-one-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-one_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-one_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-one-1" class="mw-reference-text">1</span></li></ol></div>
2019-03-19 15:39:23 +00:00
!! end
2019-04-19 20:04:49 +00:00
!! test
T220196 - Reference names with high-bit characters, html5 mode
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5" ]
2019-04-19 20:04:49 +00:00
!! wikitext
<ref name="füllen">[bar]</ref>
<references />
!! html/php
<p><sup id="cite_ref-füllen_1-0" class="reference"><a href="#cite_note-füllen-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-füllen-1"><span class="mw-cite-backlink"><a href="#cite_ref-füllen_1-0">↑</a></span> <span class="reference-text">[bar]</span>
</li>
</ol></div>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-füllen_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"füllen"},"body":{"id":"mw-reference-text-cite_note-füllen-1"}}'><a href="./Parser_test#cite_note-füllen-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-füllen-1" id="cite_note-füllen-1"><a href="./Parser_test#cite_ref-füllen_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-füllen-1" class="mw-reference-text">[bar]</span></li></ol></div>
2019-04-19 20:04:49 +00:00
!! end
!! test
T220196 - Reference names with high-bit characters, legacy mode
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "legacy" ]
2019-04-19 20:04:49 +00:00
!! wikitext
<ref name="füllen">[bar]</ref>
<references />
!! html/php
<p><sup id="cite_ref-f.C3.BCllen_1-0" class="reference"><a href="#cite_note-f.C3.BCllen-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-f.C3.BCllen-1"><span class="mw-cite-backlink"><a href="#cite_ref-f.C3.BCllen_1-0">↑</a></span> <span class="reference-text">[bar]</span>
</li>
</ol></div>
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-füllen_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"füllen"},"body":{"id":"mw-reference-text-cite_note-füllen-1"}}'><a href="./Parser_test#cite_note-füllen-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-füllen-1" id="cite_note-füllen-1"><a href="./Parser_test#cite_ref-füllen_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-füllen-1" class="mw-reference-text">[bar]</span></li></ol></div>
2019-04-19 20:04:49 +00:00
!! end
2019-11-22 18:38:40 +00:00
## Just a regression test
!! test
Transclusion parameter spacing is lost without data-parsoid
!! options
parsoid=wt2wt
!! wikitext
2020-05-07 17:11:52 +00:00
<ref>{{1x|
2019-11-22 18:38:40 +00:00
Hi ho
}}</ref>
<!-- Traverse with an encapsulation where the root isn't a native extension -->
2020-05-07 17:11:52 +00:00
{{1x|<div><references /></div>}}
2019-11-22 18:38:40 +00:00
!! html/parsoid
!! end
2020-01-17 09:40:42 +00:00
!! test
2024-03-04 11:17:12 +00:00
T269531: Generic error message when a list-defined reference is not used in the text
2020-01-17 09:40:42 +00:00
!! wikitext
<references>
<ref name="foo">foo</ref>
</references>
2021-07-30 15:03:25 +00:00
!! html/php
2024-03-04 11:17:12 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "foo" defined in <code><references></code> is not used in prior text.</span>
2020-01-17 09:40:42 +00:00
</p>
2021-07-30 15:03:25 +00:00
!! html/parsoid
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{},"body":{"html":"\n<sup about=\"#mwt3\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"foo\"},\"body\":{\"id\":\"mw-reference-text-cite_note-foo-1\"},\"errors\":[{\"key\":\"cite_error_references_missing_key\",\"params\":[\"foo\"]}]}'><a href=\"./Parser_test#cite_note-foo-1\" style=\"counter-reset: mw-Ref 1;\"><span class=\"mw-reflink-text\">[1]</span></a></sup>\n"}}'><ol class="mw-references references"><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">foo</span></li></ol></div>
2020-01-17 09:40:42 +00:00
!! end
2024-03-04 11:17:12 +00:00
!! test
T269531: Special case when a named group is entirely unused in the text
!! wikitext
<references group="g">
<ref name="a" group="g">a</ref>
</references>
!! html/php
2024-03-04 11:41:25 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "a" defined in <code><references></code> is not used in prior text.</span>
2024-03-04 11:17:12 +00:00
</p>
!! html/parsoid
<div class="mw-references-wrap" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"g"},"body":{"html":"\n<sup class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref mw:Error\" data-mw='{\"name\":\"ref\",\"attrs\":{\"name\":\"a\",\"group\":\"g\"},\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"errors\":[{\"key\":\"cite_error_references_missing_key\",\"params\":[\"a\"]}]}'><a href=\"./Parser_test#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"g\"><span class=\"mw-reflink-text\">[g 1]</span></a></sup>\n"}}'>
<ol class="mw-references references" data-mw-group="g">
<li id="cite_note-a-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">a</span></li>
</ol>
</div>
!! end
2022-05-11 23:08:15 +00:00
# T307741: Parsoid fails this test in both standalone and integrated modes.
2020-01-17 09:40:42 +00:00
!! test
T242437 - Blank ref name in #tag regression
!! wikitext
{{#tag:references|
<ref name="">foo</ref>
}}
!! html
2020-01-20 10:40:12 +00:00
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> has no name attribute.</span>
</p>
2020-01-17 09:40:42 +00:00
!! end
2020-01-17 19:48:51 +00:00
2022-05-11 23:08:15 +00:00
# While the ref numbering is identical, the ref links with Parsoid's implementation
# are different (#cite_ref-3 in Parsoid vs #cite_ref-4). Not sure why the legacy
# implementation jumps from #cite_ref-a_2-0 to #cite_ref-4 skipping 3.
# Tracked in T307741.
2020-01-24 12:02:53 +00:00
!! test
T48140 - Make sure rollback/redo does not consume numbers
!! wikitext
<ref>should be [1]</ref>
<ref name="a" group="g" />
{{#tag:references|
<ref name="a">a</ref>
|group=g}}
<ref>should be [2]</ref>
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
<sup id="cite_ref-a_2-0" class="reference"><a href="#cite_note-a-2">[g 1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-2"><span class="mw-cite-backlink"><a href="#cite_ref-a_2-0">↑</a></span> <span class="reference-text">a</span>
</li>
</ol></div>
2020-04-01 22:13:31 +00:00
<p><sup id="cite_ref-4" class="reference"><a href="#cite_note-4">[2]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2020-01-24 12:02:53 +00:00
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">should be [1]</span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a></span> <span class="reference-text">should be [2]</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<sup about="#mwt6" class="mw-ref reference" id="cite_ref-a_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","group":"g"}}'><a href="./Parser_test#cite_note-a-2" style="counter-reset: mw-Ref 1;" data-mw-group="g"><span class="mw-reflink-text">[g 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt9" data-parsoid='{"group":"g","pi":[[{"k":"1"},{"k":"group","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:references","function":"tag"},"params":{"1":{"wt":"\n<ref name=\"a\">a</ref>\n"},"group":{"wt":"g"}},"i":0}}]}'><ol class="mw-references references" data-mw-group="g"><li about="#cite_note-a-2" id="cite_note-a-2"><a href="./Parser_test#cite_ref-a_2-0" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-2" class="mw-reference-text">a</span></li></ol></div>
<p><sup about="#mwt18" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt19" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">should be [1]</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">should be [2]</span></li></ol></div>
2020-01-24 12:02:53 +00:00
!! end
2022-05-11 23:08:15 +00:00
# While the ref numbering is identical, the ref links with Parsoid's implementation
# are different (#cite_ref-c_2-0 in Parsoid vs #cite_ref-c_3-0). Not sure why the
# legacy implementation jumps from a_1 to c_3 skipping 2 in between.
# Tracked in T307741.
2020-01-20 20:11:54 +00:00
!! test
Numbers in the default group need to start with 1, independent from other groups
!! wikitext
<ref name="a" group="g" />
{{#tag:references|
<ref name="a">a</ref>
|group=g}}
<ref name="c">c</ref>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[g 1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">a</span>
</li>
</ol></div>
2020-04-01 22:13:31 +00:00
<p><sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
2020-01-20 20:11:54 +00:00
<li id="cite_note-c-3"><span class="mw-cite-backlink"><a href="#cite_ref-c_3-0">↑</a></span> <span class="reference-text">c</span>
</li>
</ol></div>
2022-05-11 23:08:15 +00:00
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a","group":"g"}}'><a href="./Parser_test#cite_note-a-1" style="counter-reset: mw-Ref 1;" data-mw-group="g"><span class="mw-reflink-text">[g 1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt6" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:references","function":"tag"},"params":{"1":{"wt":"\n<ref name=\"a\">a</ref>\n"},"group":{"wt":"g"}},"i":0}}]}'><ol class="mw-references references" data-mw-group="g"><li about="#cite_note-a-1" id="cite_note-a-1"><a href="./Parser_test#cite_ref-a_1-0" data-mw-group="g" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">a</span></li></ol></div>
<p><sup about="#mwt15" class="mw-ref reference" id="cite_ref-c_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"c"},"body":{"id":"mw-reference-text-cite_note-c-2"}}'><a href="./Parser_test#cite_note-c-2" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt16" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-c-2" id="cite_note-c-2"><a href="./Parser_test#cite_ref-c_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-c-2" class="mw-reference-text">c</span></li></ol></div>
2020-01-20 20:11:54 +00:00
!! end
2020-01-17 19:48:51 +00:00
!! test
Serialize reference tags by themselves on a line
!! options
parsoid=html2wt
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>hi <sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">ho</span></li></ol></div><p>hi ho</p>
2020-01-17 19:48:51 +00:00
!! wikitext
hi <ref>ho</ref>
<references />
hi ho
!! end
2021-07-30 15:03:25 +00:00
## Edge case bugs in Parsoid from T93580
!! test
T93580: 1. Templated <ref> inside block images
2023-05-10 23:27:18 +00:00
!! config
wgParserEnableLegacyMediaDOM=false
2021-07-30 15:03:25 +00:00
!! wikitext
[[File:Foobar.jpg|thumb|Caption with templated ref: {{1x|<ref>foo</ref>}}]]
<references />
2023-05-10 23:27:18 +00:00
!! html/php
<figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Foobar.jpg" class="mw-file-description"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="mw-file-element" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a><figcaption>Caption with templated ref: <sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></figcaption></figure>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
2023-05-12 13:59:44 +00:00
!! html/parsoid
<figure class="mw-default-size" typeof="mw:File/Thumb"><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" class="mw-file-element"/></a><figcaption>Caption with templated ref: <sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<ref>foo</ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
2021-07-30 15:03:25 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
T93580: 2. <ref> inside inline images
2023-05-10 23:27:18 +00:00
!! config
wgParserEnableLegacyMediaDOM=false
2021-07-30 15:03:25 +00:00
!! wikitext
[[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
<references />
2023-05-10 23:27:18 +00:00
!! html/php
<p><span class="mw-default-size" typeof="mw:File"><a href="/wiki/File:Foobar.jpg" class="mw-file-description" title="Undisplayed caption in inline image with ref: [1]"><img alt="Undisplayed caption in inline image with ref: [1]" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></a></span>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
2023-05-12 13:59:44 +00:00
!! html/parsoid
<p><span class="mw-default-size" typeof="mw:File" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: <ref>foo</ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: <sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[64,78,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"}'><a href="./File:Foobar.jpg" class="mw-file-description" title="Undisplayed caption in inline image with ref:"><img alt="Undisplayed caption in inline image with ref:" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}' class="mw-file-element"/></a></span></p>
2021-07-30 15:03:25 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
T93580: 3. Templated <ref> inside inline images
2023-05-10 23:27:18 +00:00
!! config
wgParserEnableLegacyMediaDOM=false
2021-07-30 15:03:25 +00:00
!! wikitext
[[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{1x|<ref>{{1x|foo}}</ref>}}]]
<references />
2023-05-10 23:27:18 +00:00
!! html/php
<p><span class="mw-default-size" typeof="mw:File"><a href="/wiki/File:Foobar.jpg" class="mw-file-description" title="Undisplayed caption in inline image with ref: [1]"><img alt="Undisplayed caption in inline image with ref: [1]" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></a></span>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">foo</span>
</li>
</ol></div>
2023-05-12 13:59:44 +00:00
!! html/parsoid
<p><span class="mw-default-size" typeof="mw:File" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{1x|<ref>{{1x|foo}}</ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: <sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid='{\"dsr\":[64,92,null,null],\"pi\":[[{\"k\":\"1\"}]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"&lt;ref>{{1x|foo}}&lt;/ref>\"}},\"i\":0}}]}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"}'><a href="./File:Foobar.jpg" class="mw-file-description" title="Undisplayed caption in inline image with ref:"><img alt="Undisplayed caption in inline image with ref:" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}' class="mw-file-element"/></a></span></p>
2021-07-30 15:03:25 +00:00
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Report bad attributes in reference tags
!! wikitext
<ref>noGroupOrNameValue</ref>
<references badattrib="invalidAttribute" />
<ref name="theName">theNameValue</ref>
<references name="theName" badattrib="invalidNameAttribute" />
<ref group="theGroup">theGroupValue</ref>
<references group="theGroup" badattrib="invalidGroupAttribute" />
!! html/php
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><references></code> tag</span>
<sup id="cite_ref-theName_2-0" class="reference"><a href="#cite_note-theName-2">[2]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><references></code> tag</span>
<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[theGroup 1]</a></sup>
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid parameter in <code><references></code> tag</span>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">noGroupOrNameValue</span>
</li>
<li id="cite_note-theName-2"><span class="mw-cite-backlink"><a href="#cite_ref-theName_2-0">↑</a></span> <span class="reference-text">theNameValue</span>
</li>
</ol></div><p><br /><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tags exist for a group named "theGroup", but no corresponding <code><references group="theGroup"/></code> tag was found</span></p>
!! html/parsoid
<p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Error" about="#mwt4" data-mw='{"name":"references","attrs":{"badattrib":"invalidAttribute"},"errors":[{"key":"cite_error_references_invalid_parameters"}]}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">noGroupOrNameValue</span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt6" class="mw-ref reference" id="cite_ref-theName_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"theName"},"body":{"id":"mw-reference-text-cite_note-theName-2"}}'><a href="./Parser_test#cite_note-theName-2" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Error" about="#mwt8" data-mw='{"name":"references","attrs":{"name":"theName","badattrib":"invalidNameAttribute"},"errors":[{"key":"cite_error_references_invalid_parameters"}]}'><ol class="mw-references references"><li about="#cite_note-theName-2" id="cite_note-theName-2"><a href="./Parser_test#cite_ref-theName_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-theName-2" class="mw-reference-text">theNameValue</span></li></ol></div>
2021-07-30 15:03:25 +00:00
<p><sup about="#mwt10" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"theGroup"},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 1;" data-mw-group="theGroup"><span class="mw-reflink-text">[theGroup 1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Error" about="#mwt12" data-parsoid='{"group":"theGroup"}' data-mw='{"name":"references","attrs":{"group":"theGroup","badattrib":"invalidGroupAttribute"},"errors":[{"key":"cite_error_references_invalid_parameters"}]}'><ol class="mw-references references" data-mw-group="theGroup"><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" data-mw-group="theGroup" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">theGroupValue</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Check Cite handing of different types of whitespace in reference names
!! config
2022-05-11 23:08:15 +00:00
wgFragmentMode=[ "html5", "legacy" ]
2021-07-30 15:03:25 +00:00
!! wikitext
test space<ref name="a b">testSpaceRef</ref>
blah space<ref name="a b" />
test underbar<ref name="a_b">testUnderbarRef</ref>
blah underbar<ref name="a_b" />
test unicode u2028 whitespace<ref name="a
b">testUnicodeWhitespaceRef</ref>
blah unicode u2028 whitespace<ref name="a
b" />
<references />
!! html/php
<p>test space<sup id="cite_ref-a_b_1-0" class="reference"><a href="#cite_note-a_b-1">[1]</a></sup>
blah space<sup id="cite_ref-a_b_1-1" class="reference"><a href="#cite_note-a_b-1">[1]</a></sup>
</p><p>test underbar<sup id="cite_ref-a_b_2-0" class="reference"><a href="#cite_note-a_b-2">[2]</a></sup>
blah underbar<sup id="cite_ref-a_b_2-1" class="reference"><a href="#cite_note-a_b-2">[2]</a></sup>
2023-11-23 15:18:54 +00:00
</p><p>test unicode u2028 whitespace<sup id="cite_ref-a_b_3-0" class="reference"><a href="#cite_note-a_b-3">[3]</a></sup>
blah unicode u2028 whitespace<sup id="cite_ref-a_b_3-1" class="reference"><a href="#cite_note-a_b-3">[3]</a></sup>
2021-07-30 15:03:25 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a_b-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_b_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_b_1-1">1.1</a></sup></span> <span class="reference-text">testSpaceRef</span>
</li>
<li id="cite_note-a_b-2"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_b_2-0">2.0</a></sup> <sup><a href="#cite_ref-a_b_2-1">2.1</a></sup></span> <span class="reference-text">testUnderbarRef</span>
</li>
2023-11-23 15:18:54 +00:00
<li id="cite_note-a_b-3"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_b_3-0">3.0</a></sup> <sup><a href="#cite_ref-a_b_3-1">3.1</a></sup></span> <span class="reference-text">testUnicodeWhitespaceRef</span>
2021-07-30 15:03:25 +00:00
</li>
</ol></div>
2023-12-15 19:46:50 +00:00
!! html/parsoid
2021-07-30 15:03:25 +00:00
<p>test space<sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a b"},"body":{"id":"mw-reference-text-cite_note-a_b-1"}}'><a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
blah space<sup about="#mwt4" class="mw-ref reference" id="cite_ref-a_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a b"}}'><a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<p>test underbar<sup about="#mwt6" class="mw-ref reference" id="cite_ref-a_b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a_b"},"body":{"id":"mw-reference-text-cite_note-a_b-2"}}'><a href="./Parser_test#cite_note-a_b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
blah underbar<sup about="#mwt8" class="mw-ref reference" id="cite_ref-a_b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a_b"}}'><a href="./Parser_test#cite_note-a_b-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup></p>
2023-12-15 19:46:50 +00:00
<p>test unicode u2028 whitespace<sup about="#mwt10" class="mw-ref reference" id="cite_ref-a_b_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a\u2028b"},"body":{"id":"mw-reference-text-cite_note-a_b-3"}}'><a href="./Parser_test#cite_note-a_b-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup>
blah unicode u2028 whitespace<sup about="#mwt12" class="mw-ref reference" id="cite_ref-a_b_3-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a\u2028b"}}'><a href="./Parser_test#cite_note-a_b-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt14" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">testSpaceRef</span></li><li about="#cite_note-a_b-2" id="cite_note-a_b-2"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_b-2" class="mw-reference-text">testUnderbarRef</span></li><li about="#cite_note-a_b-3" id="cite_note-a_b-3"><span rel="mw:referencedBy"><a href="./Parser_test#cite_ref-a_b_3-0"><span class="mw-linkback-text">1 </span></a><a href="./Parser_test#cite_ref-a_b_3-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_b-3" class="mw-reference-text">testUnicodeWhitespaceRef</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
!! test
Check Cite handing of linefeed whitespace in reference names
!! wikitext
test linefeed<ref name="a
b">testLinefeedRef</ref>
<references />
!! html/php
<p>test linefeed<sup id="cite_ref-a_b_1-0" class="reference"><a href="#cite_note-a_b-1">[1]</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a_b-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_b_1-0">↑</a></span> <span class="reference-text">testLinefeedRef</span>
</li>
</ol></div>
!! html/parsoid
<p >test linefeed<sup about="#mwt2" class="mw-ref reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a b"},"body":{"id":"mw-reference-text-cite_note-a_b-1"}}'><a href="./Parser_test#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
2022-04-14 08:06:50 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Parser_test#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">testLinefeedRef</span></li></ol></div>
2021-07-30 15:03:25 +00:00
!! end
2022-05-11 23:08:15 +00:00
# The legacy parser interrupts the link and adds the link without the <sup> after that.
# That behaviour breaks more things in Parsoid, so we hoist the ref link and its sup outside instead.
!! test
<ref> in a link should hoist the link outside the link (T301293)
!! options
parsoid={
"modes": ["wt2html","selser"]
}
!! wikitext
[[Foo|''x<ref>y</ref>z'']]
!! html/parsoid
2023-02-09 21:58:10 +00:00
<p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'><i>xz</i></a><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"misnested":true}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-parsoid='{"misnested":true}'><span class="mw-reflink-text" data-parsoid='{"misnested":true}'>[1]</span></a></sup></p>
2022-05-11 23:08:15 +00:00
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">y</span></li></ol></div>
!! html/php
2023-02-09 21:58:10 +00:00
<p><a href="/wiki/Foo" title="Foo"><i>x<sup id="cite_ref-1" class="reference"></sup></i></a><i><a href="#cite_note-1">[1]</a>z</i>
2022-05-11 23:08:15 +00:00
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">y</span>
</li>
</ol></div>
!! end
!! test
Hoisting a reference should not break template continuity
!! options
parsoid={
"modes": ["wt2html","selser"]
}
!! wikitext
{{1x|hello [[Foo|''x<ref>y</ref>z'']] world}}
<references />
!! html/parsoid
2023-02-09 21:58:10 +00:00
<p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hello [[Foo|''x<ref>y</ref>z'']] world"}},"i":0}}]}'>hello </span><a rel="mw:WikiLink" href="./Foo" title="Foo" about="#mwt2"><i>xz</i></a><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>y</ref>","misnested":true}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-parsoid='{"misnested":true}'><span class="mw-reflink-text" data-parsoid='{"misnested":true}'>[1]</span></a></sup><span about="#mwt2"> world</span></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">y</span></li></ol></div>
2022-05-11 23:08:15 +00:00
!! end
!! test
Hoisting multiple references should keep references in order
!! options
parsoid={
"modes": ["wt2html","selser"]
}
!! wikitext
[[Foo|hello <ref>note 1</ref><ref>note 2</ref>]]<ref>note 3</ref>
<references />
!! html/parsoid
2023-02-09 21:58:10 +00:00
<p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>hello </a><sup about="#mwt5" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"misnested":true}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;" data-parsoid='{"misnested":true}'><span class="mw-reflink-text" data-parsoid='{"misnested":true}'>[1]</span></a></sup><sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"misnested":true}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Parser_test#cite_note-2" style="counter-reset: mw-Ref 2;" data-parsoid='{"misnested":true}'><span class="mw-reflink-text" data-parsoid='{"misnested":true}'>[2]</span></a></sup><sup about="#mwt4" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Parser_test#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt9" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">note 1</span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Parser_test#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">note 2</span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Parser_test#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">note 3</span></li></ol></div>
!! end
!! test
Red links in templated references
!! wikitext
<ref>[[Not_existing_article]]</ref>
{{1x|<references />}}
!! html/parsoid
<p><sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt5" data-parsoid='{"selfClose":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<references />"}},"i":0}}]}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Not_existing_article?action=edit&redlink=1" title="Not existing article" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Not_existing_article"},"sa":{"href":"Not_existing_article"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Not existing article"]}}'>Not_existing_article</a></span></li></ol></div>
2022-05-11 23:08:15 +00:00
!! end
2023-12-15 19:46:50 +00:00
# ->wt direction fails on this one because the first paragraph/i swallows the second one,
# and the ref is lost
!! test
Broken wikitext making a ref as extended attribute and a duplicated fragment
!! options
parsoid={
"modes": ["wt2html"]
}
!! wikitext
<i <ref>y</ref>>
z
<references />
!! html/php
<p><i id="cite_ref-1" class="reference">
</i></p><p><i id="cite_ref-1" class="reference">z
</i></p><i id="cite_ref-1" class="reference"><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">y</span>
</li>
</ol></div></i>
2024-01-05 19:25:07 +00:00
!! html/parsoid
2023-12-15 19:46:50 +00:00
<p><i about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"<ref>y</ref>":null},"sa":{"<ref>y</ref>":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'></i></p><i about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"<ref>y</ref>":null},"sa":{"<ref>y</ref>":""},"autoInsertedStart":true,"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"","html":"<sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[3,15,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"},{"html":""}]]}'>
<p>z</p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">y</span></li></ol></div></i>
!! end
!! test
Broken wikitext making a ref as extended attribute and a duplicated fragment (with 2wt tests)
!! wikitext
<i title="<ref>y</ref>">a
z
<references />
!! html/php
<p><i title="<sup id=" class="reference">a
</i></p><p><i title="<sup id=" class="reference">z
</i></p><i title="<sup id=" class="reference"><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">y</span>
</li>
</ol></div></i>
2024-01-05 19:25:07 +00:00
!! html/parsoid
2023-12-15 19:46:50 +00:00
<p><i title="" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":""},"sa":{"title":"<ref>y</ref>"},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"title"},{"html":""}]]}'>a</i></p><i title="" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":""},"sa":{"title":"<ref>y</ref>"},"autoInsertedStart":true,"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"title"},{"html":"<sup about=\"#mwt2\" class=\"mw-ref reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[10,22,5,6]}' data-mw='{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}'><a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></sup>"}]]}'>
<p>z</p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">y</span></li></ol></div></i>
!! end
2024-01-18 18:35:32 +00:00
!! article
Template:PartialTable
!! text
{|
|-
!! endarticle
## This test case is very specific to Parsoid's internals
## and is hence only tested for Parsoid's code. Parsoid uses
## a <meta> marker tag for <ref> tags and they are expanded
## much later. We are verifying that this <meta> tag usage
## doesn't prevent foster parenting.
!! test
Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
!! wikitext
{{PartialTable}}<ref>foo</ref>
|}
<references />
!! html/parsoid
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"<ref>foo</ref>\n|}"]}'>
<sup about="#mwt3" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
<tbody>
</tbody></table>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol></div>
!! end
## Note that the templates inside the references are not wrapped
!! test
Template nested in extension tag in template
!! options
title=[[Main Page]]
language=zh
!! wikitext
{{1x|hi<ref>[[ho|{{1x|hi}}]]</ref>}}
{{1x|hi<ref>[http://test.com?q={{1x|ho}}]</ref>}}
{{1x|hi<ref>-{ho|{{1x|hi}}}-</ref>}}
<references />
!! html/parsoid
<p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi<ref>[[ho|{{1x|hi}}]]</ref>"}},"i":0}}]}'>hi</span><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>[[ho|{{1x|hi}}]]</ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
<span about="#mwt6" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi<ref>[http://test.com?q={{1x|ho}}]</ref>"}},"i":0}}]}'>hi</span><sup about="#mwt6" class="mw-ref reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>[http://test.com?q={{1x|ho}}]</ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
<span about="#mwt10" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi<ref>-{ho|{{1x|hi}}}-</ref>"}},"i":0}}]}'>hi</span><sup about="#mwt10" class="mw-ref reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>-{ho|{{1x|hi}}}-</ref>"}' data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Main_Page#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt15" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references"><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"stx":"piped","a":{"href":"./Ho"},"sa":{"href":"ho"}}'>hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><a rel="mw:ExtLink nofollow" href="http://test.com?q=ho" class="external autonumber"></a></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}' data-parsoid='{"fl":["ho"]}'></span></span></li></ol></div>
!! end
!! test
Headings: Category in ref isn't hoisted
!! options
parsoid={
"modes": ["html2wt"]
}
!! html/parsoid
<h2> foo <span about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
<ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
!! wikitext
== foo <ref>bar
[[Category:Baz]] </ref> ==
<references />
!! end
!! test
Testing serialization after deletion in references
!! options
parsoid={
"modes": ["wt2wt"],
"changes": [
["#x", "remove"]
]
}
!! wikitext
hi <ref><div id="x">ho</div></ref>
<references />
!! wikitext/edited
hi <ref></ref>
<references />
!! end
!! test
Catch regression when unpacking with trailing content
!! wikitext
{{1x|Foo <references/> bar}}
!! html/parsoid
<p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Foo <references/> bar"}},"i":0}}]}'>Foo </p><div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references" ></ol></div><p about="#mwt2"> bar</p>
!! end
!! test
1. DOMDiff: Changes to <ref> content should be looked up using id
!! options
parsoid={
"modes": ["selser"],
"changes": [
["#X", "after", "bar"],
["#Y", "after", "baz"]
]
}
!! wikitext
X <ref><span id="X">foo</span></ref>
Y <ref name="a" />
<references>
<ref name="a"><span id="Y">foo</span></ref>
</references>
!! wikitext/edited
X <ref><span id="X">foo</span>bar</ref>
Y <ref name="a" />
<references>
<ref name="a"><span id="Y">foo</span>baz</ref>
</references>
!! end
!! test
2. DOMDiff: Changes to <ref> content should be looked up using id
!! options
parsoid={
"modes": ["selser"],
"changes": [
["#Z", "after", "bar"]
]
}
!! wikitext
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />
<references />
<references group="X">
<ref name="b"><span id="Z">foo</span></ref>
</references>
!! wikitext/edited
A <ref>foo bar for a</ref>
B <ref group="X" name="b" />
<references />
<references group="X">
<ref name="b"><span id="Z">foo</span>bar</ref>
</references>
!! end
!! article
Template:table_attribs_7
!! text
<noinclude>
|</noinclude>style{{=}}"background:#f9f9f9;"|Foo<ref>foo</ref>
!! endarticle
## Edge case fix to prevent future regressions
!! test
T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
!! wikitext
{|
|{{table_attribs_7}}
|}
<references />
!! html/parsoid
<table>
<tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
</tbody></table>
<div class="mw-references-wrap" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><ol class="mw-references references" ><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol></div>
!! end
# FIXME:
# 1. This potentially exposes a subtle issue in the interaction between TOC, Cite, and
# localization. Parsoid doesn't localize numbers in Cite (at all!) since it relies on CSS.
# But, with the legacy parser, a wiki with localized numbers will have an anchor
# based off a localized number if a <ref> is used in a heading. Parsoid won't!.
# 2. We probably should be a bit smarter about what to strip for tags when that output
# comes from extensions. Below, we have stripped all extension typeofs and info.
# But, depends on who uses this 'line' property and how.
!! test
Handle extension content in section headers properly
!! config
wgFragmentMode=[ "html5", "legacy" ]
!! options
nohtml
showtocdata
parsoid={
"modes": [ "wt2html" ],
"wrapSections": true
}
!! wikitext
==c<ref>d</ref>==
!! metadata/php
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup>[1]</sup>
!! metadata/parsoid
Sections:
h2 index:1 toclevel:1 number:1 title:Parser_test off:0 anchor/linkAnchor:c[1] line:c<sup><span>[1]</span></sup>
!! end
2023-12-15 19:46:50 +00:00