Template:Tx/doc: Difference between revisions
Appearance
No edit summary |
|||
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Purpose == | |||
This is just a simple way to display a template example in curly braces instead of typing out | This is just a simple way to display a template example in curly braces instead of typing out | ||
<pre> | <pre> | ||
<code><nowiki> ... </nowiki></code> | <code><nowiki><nowiki> ... </nowiki></nowiki></code> | ||
</pre> | </pre> | ||
Example: | == Example == | ||
<nowiki>{{tx|stub}}</nowiki> | |||
{{tx|stub}} | |||
== Displaying unnamed parameters == | |||
You can show up to 10 parameters without worrying about the pipe characters being parsed: | |||
<nowiki>{{tx|main|Triparic language}}</nowiki> | |||
{{tx|main|Triparic language}} | |||
== Displaying named parameters == | |||
But if you want to show a named parameter with an equals sign, you need to use {{tx|{{=}}}} to "protect" the equals sign: | |||
<nowiki>{{tx|foo|bar{{=}}baz}}</nowiki> | |||
{{tx|foo|bar{{=}}baz}} | |||
To show an example spanning multiple lines, you will need to place a <code><br></code> after each parameter, but ''not'' after the template name. | |||
<nowiki>{{tx|TemplateName | |||
|param1{{=}}A<br> | |||
|param2{{=}}B<br> | |||
|param3{{=}}C<br> | |||
|...}}</nowiki> | |||
{{tx|m=yes|TemplateName | |||
|param1{{=}}A<br> | |||
|param2{{=}}B<br> | |||
|param3{{=}}C<br> | |||
|...}} | |||
== Inline option == | |||
To display the template inline, add the {{c|i{{=}}y}} option: | |||
<nowiki>This version of {{tx|i=y|stub}} will render inline.</nowiki> | |||
This version of {{tx|i=y|stub}} will render inline. | |||
{{ | The [[Template:txi|{{txi|txi}}]] template is provided as shorthand for this. | ||
== Caveats == | |||
If you have an example which includes links, files, text which would come out formatted, etc. you're better off just using the {{c|<nowiki>}} tag: | |||
{{ | <nowiki>{{ambox | ||
| name = Stub | |||
| type = content | |||
| image = [[File:Empire arms.png|40px]] | |||
| text = ''This SeptemWiki article is a stub. Help us out by [{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it]. | |||
| category = Articles to be expanded | |||
}}</nowiki> |
Latest revision as of 18:27, 9 April 2016
Purpose
This is just a simple way to display a template example in curly braces instead of typing out
<code><nowiki> ... </nowiki></code>
Example
{{tx|stub}}
{{stub}}
Displaying unnamed parameters
You can show up to 10 parameters without worrying about the pipe characters being parsed:
{{tx|main|Triparic language}}
{{main|Triparic language}}
Displaying named parameters
But if you want to show a named parameter with an equals sign, you need to use
{{=}}
to "protect" the equals sign:
{{tx|foo|bar{{=}}baz}}
{{foo|bar=baz}}
To show an example spanning multiple lines, you will need to place a <br>
after each parameter, but not after the template name.
{{tx|TemplateName |param1{{=}}A<br> |param2{{=}}B<br> |param3{{=}}C<br> |...}}
{{TemplateName
|param1=A
|param2=B
|param3=C
|...}}
|param2=B
|param3=C
|...}}
Inline option
To display the template inline, add the i=y
option:
This version of {{tx|i=y|stub}} will render inline.
This version of {{stub}}
will render inline.
The {{txi}}
template is provided as shorthand for this.
Caveats
If you have an example which includes links, files, text which would come out formatted, etc. you're better off just using the <nowiki>
tag:
{{ambox | name = Stub | type = content | image = [[File:Empire arms.png|40px]] | text = ''This SeptemWiki article is a stub. Help us out by [{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it]. | category = Articles to be expanded }}