Difference between revisions of "Template:Cite IETF/refanchor/doc"

From blackwiki
Jump to navigation Jump to search
imported>CharlesGillingham
(Subcategorizing. This is not a "general purpose" citation template and is more similar to other templates in "Specific-source citation templates".)
imported>Vanisaac
m (→‎top: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
  
 
It is invoked as:
 
It is invoked as:
: <tt><nowiki>{{Cite IETF/refanchor</nowiki></tt>
+
: <kbd><nowiki>{{Cite IETF/refanchor</nowiki></kbd>
:: | <tt>Prefix</tt> = text used to prefix template result
+
:: | <kbd>Prefix</kbd> = text used to prefix template result
:: | <tt>Sep</tt> = text used to separate the document type and identifier
+
:: | <kbd>Sep</kbd> = text used to separate the document type and identifier
:: | <tt>Id</tt> = ''<value of ''{{para|id}}'' parameter>''
+
:: | <kbd>Id</kbd> = ''<value of ''{{para|id}}'' parameter>''
:: | <tt>Rfc</tt> = ''<value of ''{{para|rfc}}'' parameter>''
+
:: | <kbd>Rfc</kbd> = ''<value of ''{{para|rfc}}'' parameter>''
:: | <tt>Std</tt> = ''<value of ''{{para|std}}'' parameter>''
+
:: | <kbd>Std</kbd> = ''<value of ''{{para|std}}'' parameter>''
:: | <tt>Bcp</tt> = ''<value of ''{{para|bcp}}'' parameter>''
+
:: | <kbd>Bcp</kbd> = ''<value of ''{{para|bcp}}'' parameter>''
:: | <tt>Fyi</tt> = ''<value of ''{{para|fyi}}'' parameter>''
+
:: | <kbd>Fyi</kbd> = ''<value of ''{{para|fyi}}'' parameter>''
:: | <tt>Draft</tt> = ''<value of ''{{para|draft}}'' parameter>''
+
:: | <kbd>Draft</kbd> = ''<value of ''{{para|draft}}'' parameter>''
:: | <tt>Ien</tt> = ''<value of ''{{para|ien}}'' parameter>''
+
:: | <kbd>Ien</kbd> = ''<value of ''{{para|ien}}'' parameter>''
:: | <tt>Rtr</tt> = ''<value of ''{{para|rtr}}'' parameter>''
+
:: | <kbd>Rtr</kbd> = ''<value of ''{{para|rtr}}'' parameter>''
: <tt><nowiki>}}</nowiki></tt>
+
: <kbd><nowiki>}}</nowiki></kbd>
  
 
It uses the following algorithm:
 
It uses the following algorithm:
Line 31: Line 31:
 
* "<code><nowiki>{{Cite IETF/refanchor |Rfc = 2119}}</nowiki></code>" produces "{{#tag:nowiki|{{Cite IETF/refanchor |Rfc = 2119}}}}".
 
* "<code><nowiki>{{Cite IETF/refanchor |Rfc = 2119}}</nowiki></code>" produces "{{#tag:nowiki|{{Cite IETF/refanchor |Rfc = 2119}}}}".
  
<includeonly>
+
<includeonly>{{Sandbox other||
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Specific-source templates]]
 
[[Category:Specific-source templates]]
</includeonly>
+
}}</includeonly>

Latest revision as of 05:23, 24 April 2020

This template is a "subroutine" of {{Cite IETF}} used for conditionally generating an anchor name.

It is invoked as:

{{Cite IETF/refanchor
| Prefix = text used to prefix template result
| Sep = text used to separate the document type and identifier
| Id = <value of |id= parameter>
| Rfc = <value of |rfc= parameter>
| Std = <value of |std= parameter>
| Bcp = <value of |bcp= parameter>
| Fyi = <value of |fyi= parameter>
| Draft = <value of |draft= parameter>
| Ien = <value of |ien= parameter>
| Rtr = <value of |rtr= parameter>
}}

It uses the following algorithm:

  1. If any of |Rfc=, |Std=, |Bcp=, |Fyi=, |Draft=, |Ien=, or |Rtr= parameters are given, the template will display one of those parameter types and the associated value.
  2. The template will give priority to the first of the parameters: |Rfc=, |Std=, |Bcp=, |Fyi=, |Draft=, |Ien=, or |Rtr= in this order and use the first matching parameter.
  3. If none of the above parameters are given and the |Id= parameter is given the template will simply display that value.
  4. If the |Prefix= parameter is given the template output is prefixed with this value.
  5. If the |Sep= parameter is given, this value will be placed between the document type and identifier.

This "subroutine" is designed for {{Cite IETF}} and makes assumptions that may not be valid elsewhere.

Examples:

  • "{{Cite IETF/refanchor |Prefix = IETF |Rfc = 2119 |Bcp = 4}}" produces "IETF_RFC 2119".
  • "{{Cite IETF/refanchor |Rfc = 2119}}" produces "RFC 2119".