Template:CR: Difference between revisions

From MTG Wiki
Jump to navigation Jump to search
>Yandere-sliver
>Yandere-sliver
(Replaced content with "<includeonly>{{#invoke:CR|CRTemplateCall|toc={{{toc|}}}|glossary={{{glossary|}}}|exact={{{exact|}}}|lookup={{{lookup|}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}</includeonly...")
Line 1: Line 1:
<includeonly>{{#invoke:CR|CRTemplateCall|toc={{{toc|}}}|glossary={{{glossary|}}}|exact={{{exact|}}}|lookup={{{lookup|}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}</includeonly><noinclude>
<includeonly>{{#invoke:CR|CRTemplateCall|toc={{{toc|}}}|glossary={{{glossary|}}}|exact={{{exact|}}}|lookup={{{lookup|}}}|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}</includeonly><noinclude>{{documentation}</noinclude>
{{Lua|CR}}
'''Template:CR''' allows wiki pages to transclude text from the [[Comprehensive Rules]] without labor-intensive copy/pasting and formatting. The text returned is neatly formatted and encapsulated, and includes the date of the most recent rules change as an indicator of accuracy.
 
This template supports searches for defined rules terminology and glossary vocabulary. If absolutely necessary, it can also search for a rules entry by its index (the combination of numbers and letters preceding a specific line in the Comprehensive Rules), but this is not recommended, as new rules changes may alter the text at a given index.
 
Again, '''using the title of a rules section is recommended where possible.'''
 
Template:CR can also be used to format a wiki-linked table of contents for higher-level article pages.
== Usage ==
Template:CR accepts up to four values, though some combinations do not make sense.
 
* '''lookup'''
** The term or index to search for in the Comprehensive Rules. For example, ''trample'', ''Limited'', or ''112''.
* '''exact'''
** If included, the returned text will include only the first line of text matching the '''lookup'''.
* '''toc'''
** If included, attempts to generate a table of contents starting at the lookup. ''Only works with numeric, index-based lookups, not titles.''
* '''glossary'''
** If included, confines the search to the glossary at the end of the CR. Generally not necessary, but may improve performance.
 
Any parameter other than "exact", "glossary", or "toc" is assumed to be the lookup. Parameters can be explicitly labelled, however. All of the following return the same result.
: <code><nowiki>{{CR|exact|100}}</nowiki></code>
: <code><nowiki>{{CR|exact|lookup=100}}</nowiki></code>
: <code><nowiki>{{CR|exact=true|lookup=100}}</nowiki></code>
 
== Examples ==
=== Title vs. index ===
Code:
: <code><nowiki>{{CR|Ending the Game}}</nowiki></code>
Result: {{CR|Ending the Game}}
Code:
: <code><nowiki>{{CR|lookup=104}}</nowiki></code>
Result: {{CR|104}}
 
 
=== Table of contents ===
<code>toc</code> limits the transcluded text to one level of nesting within the rules, appropriate for making a table of contents or giving an overview.
 
Code:
: <code><nowiki>{{CR|toc=true|lookup=8}}</nowiki></code>
Result: {{CR|toc=true|lookup=8}}
 
=== Exact ===
<code>exact</code> limits the transluded text to ''only'' the index specified, without any nested subsections.
 
Code:
:<code><nowiki>{{CR|exact=true|lookup=105.2}}</nowiki></code>
Result: {{CR|exact=true|lookup=105.2}}
 
=== Glossary ===
<code>glossary</code> limits the search to only the glossary of the Comprehensive Rules. If omitted, a search for a non-numeric lookup will attempt to search the glossary ''if that term is not found in the body of the Rules''.
==== Rules terms ====
Code:
:<code><nowiki>{{CR|glossary|Double Strike}}</nowiki></code>
Result: {{CR|glossary|Double Strike}}
Code:
:<code><nowiki>{{CR|Double Strike}}</nowiki></code>
Result: {{CR|Double Strike}}
==== Non-rules terms ====
Code:
:<code><nowiki>{{CR|glossary|Dies}}</nowiki></code>
Result: {{CR|glossary|Dies}}
==== Obsolete terms ====
Code:
:<code><nowiki>{{CR|glossary|Bury}}</nowiki></code>
Result: {{CR|glossary|Bury}}
 
==See also==
*{{tl|examples}}
*{{tl|rules}}
</noinclude>

Revision as of 02:51, 18 June 2019

{{documentation}