Template:Ref: Difference between revisions

From OniGalore
(rewrote logic in order to *really* fix group and name parameters)
(added support back in for alpha refs)
Line 2: Line 2:
   #if:{{{name|}}}
   #if:{{{name|}}}
   |{{
   |{{
     #if:{{{group|}}}
     #ifeq:{{{alpha}}}
    |{{#tag:ref|{{{1}}}|name={{{name}}}|group={{{group}}}}}
    |yes
    |{{#tag:ref|{{{1}}}|name={{{name}}}}}
    |{{#tag:ref|{{{1}}}|name={{{name}}}|group=lower-alpha}}
    |{{
      #if:{{{group|}}}
      |{{#tag:ref|{{{1}}}|name={{{name}}}|group={{{group}}}}}
      |{{#tag:ref|{{{1}}}|name={{{name}}}}}
    }}
   }}
   }}
   |{{
   |{{
     #if:{{{group|}}}
     #ifeq:{{{alpha}}}
    |{{#tag:ref|{{{1}}}|group={{{group}}}}}
    |yes
    |{{#tag:ref|{{{1}}}}}
    |{{#tag:ref|{{{1}}}|group=lower-alpha}}
    |{{
      #if:{{{group|}}}
      |{{#tag:ref|{{{1}}}|group={{{group}}}}}
      |{{#tag:ref|{{{1}}}}}
    }}
   }}
   }}
}}</includeonly><noinclude>
}}</includeonly><noinclude>

Revision as of 05:21, 23 April 2025

A shortcut for creating a reference in an article. Call this with the syntax {{ref|Text of your reference.}} to place a ref in an article, and then list the references at the end of the article using Template:Reflist. If the text that you pass in contains a '=' or '|' (pipe), you need to escape them because they have special meanings in template calls. The equals sign is escaped with the use of {{=}} and the pipe with {{!}}.

If you want to only list ref tags in a certain group, use the "group" parameter: {{ref|group=group_name|Text of your reference.}}. See Oni for an example usage.

If you want your references to use letters instead of numbers, use {{ref|alpha=yes|Text of your reference.}}.