Template:Refn/doc

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
Jump to navigation Jump to search
Information icon-grey.svg
This is a documentation subpage for Template:Refn.
It contains usage information, categories, and other content that is not part of the original template page.

This template is for inserting references that may require more complex content than just plain text with links - the most common use-case is nesting references.

About

Normal <ref> tags cannot directly contain any parser/preprocessor functions. This includes standard parser functions, particularly #if and similar, as well as other <ref> tags. For parser functions, a way to counter this is to use a template to abstract the function. An alternative method is to use the #tag parser function - which is what this template does, more cleanly.

In addition, preprocessor extensions (like <ref> tags) must be nested in this way.

Usage

{{Refn|reference content}}

Refn also supports the two most commonly used extra parameters, name and group:

{{Refn|reference content|name=ref name|group=ref group}}
Nesting

As mentioned, the most common use-case is nesting references. When nesting references, the outer <ref> tags must be replaced by this template - the innermost tag can remain a <ref> tag, but Refn cannot be inside a <ref> tag at all. The standardised CiteX templates (e.g. Template:CiteGeneral) all utilise this method already, so are nestable.

{{Refn|outer reference content{{Refn|nested reference for the outer reference content}}}}

Note that the references will be in ordered in parsing order, which is the innermost to the outermost - this is generally not the most logical order for reading, so making footnotes of footnotes or citations of citations is not advised - mix groups.

Examples

Markup
* text {{Refn|reference content 1}}
* text 2 {{Refn|outer reference content{{Refn|nested reference for the outer reference content}}}}
* text 3 {{Refn|outer refn<ref>inner reftag</ref>}}

;Reflist
<references />
Result
Reflist
  1. ^ reference content 1
  2. ^ nested reference for the outer reference content
  3. ^ outer reference content[2]
  4. ^ inner reftag
  5. ^ outer refn[4]

Here you can clearly see the inner tags sorted before the outer tags.

See also