TemplateDoc:Acronym: Difference between revisions
From Halopedia, the Halo wiki
(Inserting TemplateDoc notice) |
No edit summary |
||
Line 38: | Line 38: | ||
|} | |} | ||
== | ==Description== | ||
This template is used to sanitise Halopedia [[Halopedia:Acronyms|acronyms]] before they are used in other templates. It does ''not'' guarantee that an acronym is valid, as the correct response to an invalid acronym will vary between templates that call this one. However, it guarantees that what it returns will be in lower case and that, if it ''was'' a valid acronym, it will have been replaced with the '''primary''' acronym for that topic. For instance, <code>HTFoR</code> will have been replaced with <code>tfor</code>. This allows template pages to only have to consider the primary acronym cases, while still providing support for the secondary acronyms. | This template is used to sanitise Halopedia [[Halopedia:Acronyms|acronyms]] before they are used in other templates. It does ''not'' guarantee that an acronym is valid, as the correct response to an invalid acronym will vary between templates that call this one. However, it guarantees that what it returns will be in lower case and that, if it ''was'' a valid acronym, it will have been replaced with the '''primary''' acronym for that topic. For instance, <code>HTFoR</code> will have been replaced with <code>tfor</code>. This allows template pages to only have to consider the primary acronym cases, while still providing support for the secondary acronyms. | ||
Usually, if no acronym match is found, the template will simply return exactly what was passed to it, albeit in lower case. However, by setting the <code>NoPassthrough</code> flag, the template can be made to output nothing if the acronym does not exist. | Usually, if no acronym match is found, the template will simply return exactly what was passed to it, albeit in lower case. However, by setting the <code>NoPassthrough</code> flag, the template can be made to output nothing if the acronym does not exist. | ||
==Usage== | |||
===Syntax=== | |||
To insert this template onto a page, place the following wikitext onto the article. | |||
{|width=100% | |||
!width=50%|Simplified Version | |||
!width=50%|Full Version | |||
|- | |||
| | |||
<pre> | |||
{{Acronym | |||
| | |||
}} | |||
</pre> | |||
| | |||
<pre> | |||
{{Acronym | |||
|NoPassthrough= | |||
| | |||
}} | |||
</pre> | |||
|} | |||
===Parameters=== | ===Parameters=== | ||
Line 57: | Line 81: | ||
|<code>TFoR</code> | |<code>TFoR</code> | ||
|- | |- | ||
|''' | |'''NoPassthrough''' | ||
| - | | - | ||
|''Optional'' | |''Optional'' | ||
Line 91: | Line 115: | ||
|"{{Acronym|banana|NoPassthrough=yes}}" | |"{{Acronym|banana|NoPassthrough=yes}}" | ||
|} | |} | ||
==Dependencies== | |||
===Template dependencies=== | |||
This template depends upon the following templates: | |||
*[[Template:Acronym/Official]] | |||
*[[Template:Acronym/Game]] | |||
*[[Template:Acronym/Novel]] | |||
*[[Template:Acronym/Comic]] | |||
*[[Template:Acronym/MiscBook]] | |||
*[[Template:Acronym/Film]] | |||
*[[Template:Acronym/Marketing]] | |||
===Extension dependencies=== | |||
This template requires the following extensions: | |||
*[[mw:Extension:Variables|Variables]] - used to optimise the number of template calls made, by caching previous call results | |||
===Dependent templates=== | |||
The following templates depend upon this one. If you are making changes to this template, please ensure that they will not break any of them! | |||
*[[Template:Acronym/Exists]] | |||
*[[Template:Acronym/LongName]] | |||
*[[Template:Acronym/ShortName]] | |||
*[[Template:Acronym/ShortestName]] | |||
*[[Template:Acronym/PageName]] | |||
*[[Template:Acronym/LongLink]] | |||
*[[Template:Acronym/ShortLink]] | |||
*[[Template:Acronym/ShortestLink]] | |||
*[[Template:Acronym/Link]] | |||
<noinclude>[[Category:Shorthand template documentation]]</noinclude> | |||
<noinclude>[[Category:Acronym template documentation]]</noinclude> | <noinclude>[[Category:Acronym template documentation]]</noinclude> |
Latest revision as of 07:50, June 5, 2020
Acronym templates[edit]
Generating titles and names[edit]
|
Links[edit]
|
Sanitising specific acronym types[edit]
|
Checking acronym existence[edit]
|
Description[edit]
This template is used to sanitise Halopedia acronyms before they are used in other templates. It does not guarantee that an acronym is valid, as the correct response to an invalid acronym will vary between templates that call this one. However, it guarantees that what it returns will be in lower case and that, if it was a valid acronym, it will have been replaced with the primary acronym for that topic. For instance, HTFoR
will have been replaced with tfor
. This allows template pages to only have to consider the primary acronym cases, while still providing support for the secondary acronyms.
Usually, if no acronym match is found, the template will simply return exactly what was passed to it, albeit in lower case. However, by setting the NoPassthrough
flag, the template can be made to output nothing if the acronym does not exist.
Usage[edit]
Syntax[edit]
To insert this template onto a page, place the following wikitext onto the article.
Simplified Version | Full Version |
---|---|
{{Acronym | }} |
{{Acronym |NoPassthrough= | }} |
Parameters[edit]
Field Name | Field Aliases | Optional or Required? | Description | Example |
---|---|---|---|---|
1 (Unnamed field) | - | Required | The acronym to sanitise. | TFoR
|
NoPassthrough | - | Optional | Determines whether or not to pass the original argument through if no acronym match was found. If this flag is set - to anything at all - passthrough will be disabled. Otherwise, passthrough is enabled by default. | no
|
Error states[edit]
This template has no error states.
Examples[edit]
Here are some examples of what the template will output, when used:
Wiki markup | Result |
---|---|
"{{Acronym|CE}}"
|
"ce" |
"{{Acronym|H1X}}"
|
"ce" |
"{{Acronym|banana}}"
|
"banana" |
"{{Acronym|CE|NoPassthrough=yes}}"
|
"ce" |
"{{Acronym|H1X|NoPassthrough=yes}}"
|
"ce" |
"{{Acronym|banana|NoPassthrough=yes}}"
|
"" |
Dependencies[edit]
Template dependencies[edit]
This template depends upon the following templates:
- Template:Acronym/Official
- Template:Acronym/Game
- Template:Acronym/Novel
- Template:Acronym/Comic
- Template:Acronym/MiscBook
- Template:Acronym/Film
- Template:Acronym/Marketing
Extension dependencies[edit]
This template requires the following extensions:
- Variables - used to optimise the number of template calls made, by caching previous call results
Dependent templates[edit]
The following templates depend upon this one. If you are making changes to this template, please ensure that they will not break any of them!