Template:Refn/doc: Difference between revisions

From MicrasWiki
Jump to navigationJump to search
Hālian (talk | contribs)
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 &lt;ref&gt; tag is missing the closing &lt;/ref&gt; (see the [[:Help:Cite errors/Cite error included ref|help page]]).</span> &lt;/ref&gt;)
# <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 &lt;ref&gt; tag is missing the closing &lt;/ref&gt; (see the [[:Help:Cite errors/Cite error included ref|help page]]).</span> &lt;/ref&gt;)


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

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:

  1. <syntaxhighlight lang="HTML" inline>[3]</syntaxhighlight> (Generates: [[Help:Footnotes|]] instead of a wikilink)
  2. <syntaxhighlight lang="HTML" inline>[4]</syntaxhighlight> (Generates: {{SUBST:TODAY}} instead of the date that the edit was made)
  3. <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

Template:Tld

  • 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

Template:Refname rules

Examples

Footnotes with citations

Template:Markup

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}}.

Template:Markup

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:

Template:Markup


Help:Footnotes

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>

  1. ^ ...
  2. ^ ...
  3. ^ [[Help:Footnotes|]]
  4. ^ {{SUBST:TODAY}}
  5. ^ ...
  6. ^ ...