Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Tlc: Difference between revisions

Template page
m m
mNo edit summary
Line 1: Line 1:
[[File:18th-century Italian sculpture.jpg]]
<span style="white-space:nowrap;"><code>&#123;&#123;{{#if:{{{1|}}}|{{{1}}}| tlc&#124;...}}<!--
<span style="white-space:nowrap;"><code>&#123;&#123;{{#if:{{{1|}}}|{{{1}}}| tlc&#124;...}}<!--
-->{{#ifeq:{{{2|x}}}|{{{2|}}}| &#124;{{{2}}} | }}<!--
-->{{#ifeq:{{{2|x}}}|{{{2|}}}| &#124;{{{2}}} | }}<!--

Revision as of 02:20, 13 January 2013

File:18th-century Italian sculpture.jpg {{tlc|...}}

Template documentation[ view · edit · history · purge ]
This documentation is transcluded from Template:Tlc/doc.

This is the File:18th-century Italian sculpture.jpg {{tlc}} template.

This page also serves as the full documentation for {{Tlf}} (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 <nowiki></nowiki> tags you can write it simpler and shorter by using these templates.

Here is how these templates look. Code to the left and actual rendering to the right:

File:18th-century Italian sculpture.jpg

{{tlc|name|parameters}} = File:18th-century Italian sculpture.jpg {{name|parameters}}

File:18th-century Italian sculpture.jpg

{{tlf|name|parameters}} = {{name|parameters}}

These templates work similarly to {{Tl}} and {{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}}, {{tld}} or {{tlx}}, and then use File:18th-century Italian sculpture.jpg {{tlc}} or {{tlf}}.

Features of File:18th-century Italian sculpture.jpg {{tlc}}, {{tld}}, {{tlf}} and {{tlp}}:

  • They show a template name and up to eight parameters.
  • They also show empty parameters. (See examples below.)
  • They prevent line wraps in their output.

Examples

Wikitables make the <code></code> tags transparent, that's why the "code colouring" is missing in these examples.

CodeResultComment
File:18th-century Italian sculpture.jpg {{tlc}} File:18th-century Italian sculpture.jpg {{tlc|...}} Shows its own syntax.
File:18th-century Italian sculpture.jpg {{tlc|name}} File:18th-century Italian sculpture.jpg {{name}}
File:18th-century Italian sculpture.jpg {{tlc|name|one}} File:18th-century Italian sculpture.jpg {{name|one}}
File:18th-century Italian sculpture.jpg {{tlc|name|one|two}} File:18th-century Italian sculpture.jpg {{name|one|two}}
{{tlc|name|a|b|c|d|e|f|g|h|i|j}} File:18th-century Italian sculpture.jpg {{name|a|b|c|d|e|f|g|h}} Shows up to eight parameters. The rest are dropped.
File:18th-century Italian sculpture.jpg {{tlc|name|||three|four}} File:18th-century Italian sculpture.jpg {{name|||three|four}} Also shows empty parameters.
File:18th-century Italian sculpture.jpg {{tlc|name|||three||}} File:18th-century Italian sculpture.jpg {{name|||three||}} Even shows empty parameters that come in the end.
File:18th-century Italian sculpture.jpg {{tlc|name|one=a|two=b}} File:18th-century Italian sculpture.jpg {{name}} Equal signs is a problem, but there is a fix.
File:18th-century Italian sculpture.jpg {{tlc|name|2=one=a|3=two=b}} File:18th-century Italian sculpture.jpg {{name|one=a|two=b}} Use numbered parameters to fix it. Remember to start from 2, since the "name" is number 1.

If you have equal signs in your template parameters, you should replace them with File:18th-century Italian sculpture.jpg {{=}}, but it probably is simpler and clearer to code it using <nowiki> tags etc. Here are the codes to emulate {{tlf}} and File:18th-century Italian sculpture.jpg {{tlc}} respectively. Code to the left and actual rendering to the right:

  • <span class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></span>{{name|one=a|two=b}}
  • <code class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></code>{{name|one=a|two=b}}

TemplateData

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Template link code

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Template1

Linked template name

Templaterequired
Parameter 12

First parameter value

Stringoptional
Parameter 23

Second parameter value

Stringoptional
Parameter 34

Third parameter value

Stringoptional
Parameter 45

Fourth parameter value

Stringoptional
Parameter 56

Fifth parameter value

Stringoptional
Parameter 67

Sixth parameter value

Stringoptional
Parameter 78

Seventh parameter value

Stringoptional
Parameter 89

Eight parameter value

Stringoptional
  1. REDIRECT Commons:Link templates/Template links
Cookies help us deliver our services. By using our services, you agree to our use of cookies.