Template:Refn/doc: Difference between revisions
Created page with "{{Documentation subpage}} ===Purpose=== This template is used to create footnotes in Wikipedia, as an alternative and complement to the <syntaxhighlight lan..." |
|||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
===Purpose=== | ===Purpose=== | ||
This template is used to [[Help:Footnotes|create footnotes in Wikipedia]], as an alternative and complement to the <syntaxhighlight lang="HTML" inline><ref></syntaxhighlight>. [[:mw:Extension:Cite/Cite.php#Substitution and embedded parser functions|Because of a technical limitation]], some of the standard Wikipedia markup elements that are often used in the article prose do not work within a set of <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> tags, including but not limited to [[Help:Pipe trick|the pipe trick]], [[Wikipedia:Substitution|template substitution]] and another "nested" set of <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> tags. For example, the following does not work as expected: | This template is used to [[Help:Footnotes|create footnotes in Wikipedia]], as an alternative and complement to the <nowiki><syntaxhighlight lang="HTML" inline><ref></syntaxhighlight>.</nowiki> [[:mw:Extension:Cite/Cite.php#Substitution and embedded parser functions|Because of a technical limitation]], some of the standard Wikipedia markup elements that are often used in the article prose do not work within a set of <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> tags, including but not limited to [[Help:Pipe trick|the pipe trick]], [[Wikipedia:Substitution|template substitution]] and another "nested" set of <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> tags. For example, the following does not work as expected: | ||
# <syntaxhighlight lang="HTML" inline><ref>[[Help:Footnotes|]]</ref></syntaxhighlight> (Generates: <nowiki>[[Help:Footnotes|]]</nowiki> instead of a wikilink) | # <syntaxhighlight lang="HTML" inline><ref>[[Help:Footnotes|]]</ref></syntaxhighlight> (Generates: <nowiki>[[Help:Footnotes|]]</nowiki> instead of a wikilink) | ||
# <syntaxhighlight lang="HTML" inline><ref>{{SUBST:TODAY}}</ref></syntaxhighlight> (Generates: <nowiki>{{SUBST:TODAY}}</nowiki> instead of the date that the edit was made) | # <syntaxhighlight lang="HTML" inline><ref>{{SUBST:TODAY}}</ref></syntaxhighlight> (Generates: <nowiki>{{SUBST:TODAY}}</nowiki> instead of the date that the edit was made) | ||
# <syntaxhighlight lang="HTML" inline><ref>Explanatory footnote<ref>Citation</ref></ref></syntaxhighlight> (Generates: <span style="font-weight: bold; color: #CC0000;">Cite error: A <ref> tag is missing the closing </ref> (see the [[:Help:Cite errors/Cite error included ref|help page]]).</span> </ref>) | # <nowiki><syntaxhighlight lang="HTML" inline><ref>Explanatory footnote<ref>Citation</ref></ref></syntaxhighlight></nowiki> (Generates: <span style="font-weight: bold; color: #CC0000;">Cite error: A <ref> tag is missing the closing </ref> (see the [[:Help:Cite errors/Cite error included ref|help page]]).</span> </ref>) | ||
Replacing the outermost <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> set with {{tlp|Refn}} allows for the use of the markup elements listed above. | Replacing the outermost <syntaxhighlight lang="HTML" inline><ref>...</ref></syntaxhighlight> set with {{tlp|Refn}} allows for the use of the markup elements listed above. | ||
Revision as of 21:17, 11 January 2020
|
|
This is a [documentation] [subpage] for Template:Refn (see that page for the template itself). It contains usage information, categories, interlanguage and other content that is not part of the original template page. |
Purpose
This template is used to create footnotes in Wikipedia, as an alternative and complement to the <syntaxhighlight lang="HTML" inline><ref></syntaxhighlight>. Because of a technical limitation, some of the standard Wikipedia markup elements that are often used in the article prose do not work within a set of <syntaxhighlight lang="HTML" inline>[1]</syntaxhighlight> tags, including but not limited to the pipe trick, template substitution and another "nested" set of <syntaxhighlight lang="HTML" inline>[2]</syntaxhighlight> tags. For example, the following does not work as expected:
- <syntaxhighlight lang="HTML" inline>[3]</syntaxhighlight> (Generates: [[Help:Footnotes|]] instead of a wikilink)
- <syntaxhighlight lang="HTML" inline>[4]</syntaxhighlight> (Generates: {{SUBST:TODAY}} instead of the date that the edit was made)
- <syntaxhighlight lang="HTML" inline><ref>Explanatory footnote<ref>Citation</ref></ref></syntaxhighlight> (Generates: Cite error: A <ref> tag is missing the closing </ref> (see the help page). </ref>)
Replacing the outermost <syntaxhighlight lang="HTML" inline>[5]</syntaxhighlight> set with Template:Tlp allows for the use of the markup elements listed above.
Usage
- groupname: Groupname per WP:REFGROUP; if not specified, then the main and nested references will be rendered into the same reference list
- name: Reference name per WP:REFNAME
Examples
Footnotes with citations
Substitution
The first example shows that substitution does not work in a regular <syntaxhighlight lang="HTML" inline>[6]</syntaxhighlight> tag (the |access-date= does not appear correctly). The second example shows that the |access-date= is substituted correctly within {{refn}}.
Errors
If the reference or note content is missing, then Cite error: Invalid <ref> tag; refs with no name must have content. will be displayed.
If the note content contains an equals sign (=), the equals sign will be interpreted as setting off a named parameter and cause an error. This can be worked around by using a numbered parameter, for example:
See also
Help:Cite errors/Cite error group refs without references
Template:Wikipedia referencing
TemplateData
Template:TemplateData header <templatedata> { "params": { "1": { "label": "content", "description": "The content of the footnote.", "type": "content", "required": true, "suggested": true, "aliases": [ "refn" ] }, "name": { "description": "The name of the footnote. Corresponds to the \"name\" attribute of the <ref> tag.", "type": "string" }, "group": { "label": "group", "description": "The reference group. Corresponds to the \"group\" attribute on the <ref> tag.", "type": "string" } }, "description": "This template is used to create footnotes in Wikipedia, as an alternative and complement to the <ref> tag.", "paramOrder": [ "1", "name", "group" ], "format": "inline" } </templatedata>