Template:Tlc/doc: Difference between revisions
Template page
More actions
syntaxhighlight lang="wikitext" |
|||
| (5 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | |||
{{Uses TemplateStyles|Template:Nowrap/styles.css}} | |||
This is the {{tlc|tlc}} template. | This is the {{tlc|tlc}} template. | ||
This page | This page also serves as the full documentation for {{tl|tlf}} ([[Template:tlf/doc|doc page]]), that works almost exactly the same. | ||
When showing a template name with brackets in documentation you have to escape the brackets in some way so it doesn't become a call to the template. Instead of using <code><nowiki></nowiki></code> tags you can write it simpler and shorter by using these templates. | When showing a template name with brackets in documentation you have to escape the brackets in some way so it doesn't become a call to the template. Instead of using <code><nowiki></nowiki></code> tags you can write it simpler and shorter by using these templates. | ||
| Line 8: | Line 11: | ||
Here is how these templates look. Code to the left and actual rendering to the right: | Here is how these templates look. Code to the left and actual rendering to the right: | ||
:{{tlc|tlc|name|parameters}} = {{tlc | : {{tlc|tlc|name|parameters}} = {{tlc|name|parameters}} | ||
: {{tlc|tlf|name|parameters}} = {{tlf|name|parameters}} | |||
:{{tlc|tlf|name|parameters}} = {{tlf|name|parameters}} | |||
These templates work similarly to {{tl|tl}} and {{tlx|tlx}}, but they don't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since it decreases readability. So on the first occurrence of a template name use {{tl|tl}} or {{tlx|tlx}}, and then use {{tlc|tlc | These templates work similarly to {{tl|tl}} and {{tlx|tlx}}, but they don't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since it decreases readability. So on the first occurrence of a template name use {{tl|tl}}, {{tld|tld}} or {{tlx|tlx}}, and then use {{tlc|tlc}} or {{tlf|tlf}}. | ||
Features of {{tlc|tlc}}, {{tld|tld}} | Features of {{tlc|tlc}}, {{tld|tld}}, {{tlf|tlf}} and {{tlp|tlp}}: | ||
* They show a template name and up to eight parameters. | * They show a template name and up to eight parameters. | ||
* They also show empty parameters. (See examples below.) | * They also show empty parameters. (See examples below.) | ||
| Line 36: | Line 38: | ||
</table> | </table> | ||
If you have equal signs in your template parameters, you should replace | If you have equal signs in your template parameters, you should replace them with {{tlc|{{=}}}}, but it probably is simpler and clearer to code it using <code><nowiki></code> tags etc. Here are the codes to emulate {{tlf|tlf}} and {{tlc|tlc}} respectively. Code to the left and actual rendering to the right: | ||
* <syntaxhighlight inline lang="wikitext"><span class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></span></syntaxhighlight> → <span class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></span> | |||
* <syntaxhighlight inline lang="wikitext"><code class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></code></syntaxhighlight> → <code class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></code> | |||
== TemplateData == | |||
{{TemplateData header}} | |||
<templatedata> | |||
{ | |||
"description": "Template link code", | |||
"format": "inline", | |||
"params": { | |||
"1": { | |||
"label": "Template", | |||
"description": "Linked template name", | |||
"required": true, | |||
"type": "wiki-template-name" | |||
}, | |||
"2": { | |||
"label": "Parameter 1", | |||
"description": "First parameter value", | |||
"type": "string" | |||
}, | |||
"3": { | |||
"label": "Parameter 2", | |||
"description": "Second parameter value", | |||
"type": "string" | |||
}, | |||
"4": { | |||
"label": "Parameter 3", | |||
"description": "Third parameter value", | |||
"type": "string" | |||
}, | |||
"5": { | |||
"label": "Parameter 4", | |||
"description": "Fourth parameter value", | |||
"type": "string" | |||
}, | |||
"6": { | |||
"label": "Parameter 5", | |||
"description": "Fifth parameter value", | |||
"type": "string" | |||
}, | |||
"7": { | |||
"label": "Parameter 6", | |||
"description": "Sixth parameter value", | |||
"type": "string" | |||
}, | |||
"8": { | |||
"label": "Parameter 7", | |||
"description": "Seventh parameter value", | |||
"type": "string" | |||
}, | |||
"9": { | |||
"label": "Parameter 8", | |||
"description": "Eight parameter value", | |||
"type": "string" | |||
} | |||
} | |||
} | |||
</templatedata> | |||
{{ | {{Tl-nav}} | ||
<includeonly> | <includeonly>{{Sandbox other|| | ||
[[Category:Typing-aid templates | <!-- Categories below this line; interwikis at Wikidata --> | ||
</includeonly> | [[Category:Internal template-link templates{{#translation:}}]] | ||
[[Category:Typing-aid templates{{#translation:}}]] | |||
}}</includeonly> | |||