Template:Template parameter value/doc: Difference between revisions

Content deleted Content added
Examples: Be specific about the checked template
Category:String manipulation templates
 
(16 intermediate revisions by 6 users not shown)
Line 1:
{{Documentation subpage}}
{{Tmbox
| image = [[File:Information.svg|40px]]
| textstyle = color: black;
| text = '''''Warning'''''{{hair space}}: This template is buggy, and only works when pulling simple values, such as numbers and unformatted strings. Although the template makes some effort to handle piped links, most wikitext that includes pipes (e.g. values containing templates) cannot be pulled with this template.
}}
{{Shortcut|Template:Tmpv}}
{{Lua|Module:Template parameter value}}
Line 15 ⟶ 10:
This template works with named or numbered parameters; i.e. it can get the first parameter of {{tl|Start date}} (the year). This template is case-sensitive; i.e. setting {{para|Viewers}} will not match {{para|viewers}}. Make sure that you are listing the article where the template exists, not where it's transcluded to.
 
=== Basic Syntax ===
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|ARTICLE|TEMPLATE|TEMPLATE-COUNT|PARAMETER|PARAMETER-COUNT}}</nowiki></codesyntaxhighlight>
 
=== Examples ===
; 24th usage of |OriginalAirDate= in the 3rd usage of {<nowiki />{Episode table}} in [[List of Lucifer episodes]]
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|List of Lucifer episodes|Episode table|3|OriginalAirDate|24}}</nowiki></codesyntaxhighlight>
: {{Template parameter value|List of Lucifer episodes|Episode table|3|OriginalAirDate|24}}
 
; 2nd usage of |archiveurl= in the 1st usage of {<nowiki />{Series overview}} in [[List of Agents of S.H.I.E.L.D. episodes]]
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|List of Agents of S.H.I.E.L.D. episodes|Series overview||archiveurlarchive-url|2}}</nowiki></codesyntaxhighlight>
: {{Template parameter value|List of Agents of S.H.I.E.L.D. episodes|Series overview||archiveurlarchive-url|2}}
 
; 1st usage of |LineColor= in the 2nd usage of {<nowiki />{Episode list/sublist}} in [[Vikings (season 4)]]
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|Vikings (season 4)|Episode list/sublist|2|LineColor}}</nowiki></codesyntaxhighlight>
: {{Template parameter value|Vikings (season 4)|Episode list/sublist|2|LineColor}}
 
; 1st usage of |num_episodes= in the 1st usage of {<nowiki />{Infobox television}} in [[12 Monkeys (TV series)]]
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|12 Monkeys (TV series)|Infobox television||num_episodes}}</nowiki></codesyntaxhighlight>
: {{Template parameter value|12 Monkeys (TV series)|Infobox television||num_episodes}}
 
; 3rd parameter in the 8th usage of {<nowiki />{Start date}} in [[The Big Bang Theory]]
: <code><nowikisyntaxhighlight lang="wikitext" inline>{{Template parameter value|The Big Bang Theory|Start date|8|3}}</nowiki></codesyntaxhighlight>
: {{Template parameter value|The Big Bang Theory|Start date|8|3}}
 
; 1st parameter in the last usage of {<nowiki />{date tabke sorting}} in [[List of Falcon 9 and Falcon Heavy launches]]
== Parameters==
: <syntaxhighlight lang="wikitext" inline>{{Template parameter value|List of Falcon 9 and Falcon Heavy launches|date table sorting|-1|1}}</syntaxhighlight>
{| class="wikitable"
: {{Template parameter value|List of Falcon 9 and Falcon Heavy launches|date table sorting|-1|1}}
! colspan="2" | Parameter
 
! Description
== Template data ==
! Type
<templatedata>
! style="width:15%" | Status
{
|-
"params": {
! style="width:4%" | 1
"1": {
| Article
"label": "Page",
| The article where the template and value exist.<br />''Example:'' List of Lucifer episodes
"description": "The page to grab templates from",
| Text
"type": "wiki-page-name",
| Required
"required": true
|-
},
! 2
"2": {
| Template
"label": "Template",
| The template where the value is held in the form of a parameter.<br />''Example:'' Episode table
"description": "The template to look for in the target page",
| Text
"type": "string",
| Required
"required": true
|-
},
! 3
"3": {
| Numbered usage of template
"label": "Template index",
| How many usages of the above template are counted.<br />Setting to blank sets the value to 1; do ''not'' exclude this parameter. Exclusion means that the third parameter will become the named/numbered parameter, which will cause the template to not work (return blank).<br />''Example:'' 24
"description": "Which occurrence of the template to check for parameters in. Set to -1 for last occurrence (other negative numbers not supported).",
| Number
"type": "number"
| Optional setting<br />Required inclusion (see examples above)
},
|-
"4": {
! 4
| "label": "Parameter",
"description": "The name of the parameter to check for",
| The named/numbered parameter in the template that holds the required value.<br />For a numbered parameter, for example, the 2nd numbered parameter will have an input of 2.<br />''Example:'' OriginalAirDate / 2
"type": "string",
| Number / Text
"required": true
| Required
},
|-
"5": {
! 5
"label": "Parameter index",
| Numbered usage of parameter
"description": "Which occurrence of the parameter to check for in the template. Does not apply if \"Ignore subtemplates\" is used",
| How many usages of the above parameter are counted within the found template.<br />Setting to blank or excluding (exclusion allowed) sets the value to 1. Set to blank or 1 for a numbered parameter.<br />''Example:'' 3
"type": "number"
| Number
},
| Optional (see examples above)
"ignore_subtemplates": {
|}
"aliases": [
"ist"
],
"label": "Ignore subtemplates",
"description": "Giving this a value will make the template ignores subtemplates and their parameters when looking for a value in a template. Can be used for more precise grabbing of parameters as opposed to using a parameter index",
"type": "boolean",
"default": "no"
},
"ignore_blank": {
"label": "Ignore blank values",
"description": "Ignores keys with blank values when deciding which index of a parameter to use. This option does nothing when using ignore_subtemplates",
"type": "boolean",
"default": "no"
},
"only_subtemplates": {
"label": "Only subtemplates",
"description": "The inverse to ignore_subtemplates. Only keys that are in subtemplates of the template requested will be considered. ignore_subtemplates will take precedence over this option if both are enabled",
"type": "boolean",
"default": "no"
},
"dontprocess": {
"label": "Don't process",
"description": "If enabled, the returning result won't be processed into wikitext, and will be returned as raw data.",
"type": "boolean",
"default": "no"
},
"treat_as_regex": {
"label": "Treat as regex",
"description": "Treats the Templates input as a lua regex instead of a raw string",
"type": "boolean",
"default": "no"
}
},
"description": "A template to grab the value of parameters from templates on a page",
"format": "inline",
"paramOrder": [
"1",
"2",
"3",
"4",
"5",
"ignore_subtemplates",
"ignore_blank",
"only_subtemplates",
"dontprocess",
"treat_as_regex"
]
}</templatedata>
 
== See also ==
* {{tl|get parameter}}, another template doing the same thing with a different set of limitations
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:String manipulation templates]]
}}</includeonly>