查看“︁模板:Tlc/doc”︁的源代码
来自康健生活
←
模板:Tlc/doc
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== Purpose and naming == When a template name with braces is to be shown in documentation, the braces have to be escaped in some way so it doesn't become an actual call to the template. Instead of using {{tag|nowiki}} tags you can write it more simply and concisely by using the {{tlc|tlc}} template. It works similarly to {{tlc|tl}} and {{tlc|tlx}}, but doesn't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since they can decrease readability. So on the first occurrence of a template name use {{tlx|tl}} or {{tlx|tlx}}, and then use {{tlc|tlc}} thereafter. ===Basic operation=== Here is how this template looks. Code is to the left; actual rendering to the right: :{{tlc|tlc|name|parameters}} = {{tlc|name|parameters}} ==Documentation== ===Functional details=== * This template takes another ''template-name'' and some associated [[Help:Pipe trick|pipe-tricked]] [[m:Parameter#Parameters|(numbered) parameters]] (or 'pass parameters'), and displays them as an 'example demonstration' of how the ''template-name'' template could be coded, literally. Its primary use is in instruction and documentation. *Specifics here??? <!-- Coding details, other parameters (SUBST?), other notes? Cf. [[Template:Tlx]]. --> *Features of {{tlc|tlc}}: ** It shows a template name and up to eight parameters. ** It also shows empty parameters. (See examples hereafter.) ** It prevents line wraps in their output. ===Usage=== {{tlc|Tlc|Template|first_parameter|second|third|fourth|...|eighth}} → {{Tlc|Template|first_parameter|second|third|fourth|fifth|sixth|seventh|eighth}} === Examples === Note: Wikitables make the <code><nowiki><code>…</code></nowiki></code> tags transparent, unfortunately, so the "<code>code colouring</code>" is missing in these examples. <table class="wikitable"> <tr><th>Code<th>Result<th>Comment <tr><td>{{tlc|tlc}} <td>{{tlc}} <td>Shows its own syntax. <tr><td>{{tlc|tlc|name}} <td>{{tlc|name}} <td> <tr><td>{{tlc|tlc|name|one}} <td>{{tlc|name|one}} <td> <tr><td>{{tlc|tlc|name|one|two}} <td>{{tlc|name|one|two}} <td> <tr><td><code><nowiki>{{tlc|name|a|b|c|d|e|f|g|h|i|j}}</nowiki></code> <td>{{tlc|name|a|b|c|d|e|f|g|h|i}} <td>Shows up to eight parameters. The rest are dropped. <tr><td>{{tlc|tlc|name|||three|four}} <td>{{tlc|name|||three|four}} <td>Also shows empty parameters. <tr><td>{{tlc|tlc|name|||three||}} <td>{{tlc|name|||three||}} <td>Even shows empty parameters that come in the end. <tr><td>{{tlc|tlc|name|one{{=}}a|two{{=}}b}} <td>{{tlc|name|one=a|two=b}} <td>The use of equal signs is a problem, but there is a fix; see next row. <tr><td>{{tlc|tlc|name|one{{((}}{{=}}{{))}}a|two{{((}}{{=}}{{))}}b}} <td>{{tlc|name|one{{=}}a|two{{=}}b}} <td>Use <code><nowiki>{{=}}</nowiki></code> in place of an equal sign, so that it gets rendered properly. </table> An alternative to using constructs such as <code><nowiki>{{=}}</nowiki></code> to prevent characters from getting interpreted syntactically is to use <syntaxhighlight lang=html inline><code><nowiki>...</nowiki></code></syntaxhighlight>, which will prevent '''all''' characters from being interpreted. For example, in place of <syntaxhighlight lang=moin>{{tlc|name|one{{=}}{{tlc|IPA|/tʃ/}}|two}}</syntaxhighlight> you can use <syntaxhighlight lang=html><code><nowiki>{{name|one={{IPA|/tʃ/}}|two}}</nowiki></code></syntaxhighlight> Both render as <syntaxhighlight lang=moin>{{name|one={{IPA|/tʃ/}}|two}}</syntaxhighlight> If a vertical display with parameters on their own lines is desired, this can also be laid out manually in this manner, or more rapidly done with {{tag|pre}}. Here is the code to emulate {{tlc|tlc}} using <code><nowiki></code>: {| ! Using templates: !! Using nowiki tag: !! Rendered result: |- |style="padding-right: 50px;"| <code><nowiki>{{tlc|name|one{{=}}a|two{{=}}b}}</nowiki></code> |style="padding-right: 50px;"| <code><nowiki><code><nowiki>{{name|one=a|two=b}}</nowiki></code></nowiki></code> |<code><nowiki>{{name|one=a|two=b}}</nowiki></code> |} == TemplateData == <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>
此页面嵌入的页面:
模板:((
(
查看源代码
)
模板:))
(
查看源代码
)
模板:Nowrap/styles.css
(
查看源代码
)
模板:Tag
(
查看源代码
)
模板:Tlc
(
查看源代码
)
模板:Tlx
(
查看源代码
)
返回
模板:Tlc/doc
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。