模板:Tlg/doc
外观
< 模板:Tlg
文件:Edit-copy green.svg | 模板:Strong for 模板:Terminate sentence It may contain usage information, categories and other content that is not part of the original 模板 page. |
Warning | 此Template被引用於約64,000個頁面。 為了避免造成大規模的影響,所有對此Template的編輯應先於沙盒、測試樣例或您的-{zh-hant:使用者頁面;zh-hans:用户页}-上測試。 測試後無誤的版本可以一次性地加入此Template中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
🪧 | 此模板使用Lua语言: |
使用方法
{{tlg}}
(-{template link, general}-,即“全功能模板連結”)是用來添加模板連結的全功能模板。本模板可以代替或實現任何<syntaxhighlight lang="text" inline="">{{tl*}}</syntaxhighlight>類模板的功能,例如{{tl}}
、{{tlx}}
、{{tlb}}
。可用參數如下:
- <syntaxhighlight lang="text" inline="">code=yes</syntaxhighlight>:使用
<code>...</code>
HTML屬性(通常是等寬字體),如{{tlc}}
、{{tlx}}
、{{tlxb}}
- <syntaxhighlight lang="text" inline="">bold=yes</syntaxhighlight>:讓文字變成粗體,如
{{tlb}}
、{{tlxb}}
- <syntaxhighlight lang="text" inline="">italic=yes</syntaxhighlight>:讓參數變成斜體,如
{{tlxi}}
- <syntaxhighlight lang="text" inline="">nolink=yes</syntaxhighlight>:不連結至模板頁面,如
{{tlf}}
、{{tld}}
、{{tlc}}
- <syntaxhighlight lang="text" inline="">braceinside=yes</syntaxhighlight>:將裡面的一層括號包含在連結裡,如
{{tn}}
- <syntaxhighlight lang="text" inline="">subst=yes</syntaxhighlight>:添加<syntaxhighlight lang="text" inline="">subst:</syntaxhighlight>前綴,如
{{tls}}
- <syntaxhighlight lang="text" inline="">nosubstlink=yes</syntaxhighlight>:去除<syntaxhighlight lang="text" inline="">subst:</syntaxhighlight>的連結,暫無其他模板可替代(需要添加<syntaxhighlight lang="text" inline="">subst=yes</syntaxhighlight>才有效果)
- <syntaxhighlight lang="text" inline="">alttext=FOO</syntaxhighlight>:將連結本來顯示的文字替換成別的文字,如
{{tla}}
- <syntaxhighlight lang="text" inline="">nowrap=yes</syntaxhighlight>:在顯示結果中防止斷行
範例
- Note
- On the source sister projects, en.wikipedia and Meta, X0, X1, X2, …, X9 are sandbox templates for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.
Code | Output | Remarks |
{{tlg|Abc}} | {{Abc}} | |
{{tlg|abC}} | {{abC}} | template names are case-sensitive |
{{tlg|abc}} | {{abc}} | first letter is case-insensitive though |
{{tlg|x0}} | {{x0}} | |
{{tlg|x0|code=on}} | {{x0}} | <code> style |
{{tlg|x0|plaincode=on}} | {{x0}} | plaincode style |
{{tlg|x0|bold=on}} | {{x0}} | bold link/name |
{{tlg|x1|one|italic=on}} | {{x1|one}} | parameter/s in italics |
{{tlg|x0|nolink=on}} | {{x0}} | |
{{tlg|x0|subst=on}} | {{subst:x0}} | |
{{tlg|x0|braceinside=on}} | {{x0}} | |
{{tlg|x0|alttext=x0 link}} | {{x0 link}} | |
{{tlg|x0|bold=on|code=on|braceinside=on}} | {{x0}} | No reason you can't combine multiple parameter settings |
{{tlg|x1|one}} | {{x1|one}} | |
{{tlg|x2|one|two}} | {{x2|one|two}} | |
{{tlg|x2|bold=on|code=on|one|two}} | {{x2|one|two}} | Can combine named and anonymous parameters … |
{{tlg|x2|one|two|bold=on|code=on}} | {{x2|one|two}} | … in any order … |
{{tlg|x2|one|code=on|two|bold=on|three}} | {{x2|one|two|three}} | … even intermixed … |
{{tlg|x2|one|code=on|two|bold=on|three|italic=on}} | {{x2|one|two|three}} | … with many different configurations. |
{{tlg|x3|1|2|3|4|5|6|7|8|9|10}} | {{x3|1|2|3|4|5|6|7|8|9|10}} | |
{{tlg|x4|1|2|3|4|5|6|7|8|9|10|11}} | {{x4|1|2|3|4|5|6|7|8|9|10|…}} | up to 10 parameters, then … |
{{tlg|x5|1|2|3|4|5|6|7|8|9|10|11}} | {{x5|1|2|3|4|5|6|7|8|9|10|11}} | 模板:Align |
{{tlg}} | {{模板:Tlg/doc}} | with no arguments, the current page name is substituted |
{{tlg|x1|x=u}} | {{x1}} | = won't work |
{{tlg|x1|x=u}} | {{x1|x=u}} | 模板:Align |
{{tlg|x1|x{{=}}u}} | {{x1|x=u}} | 模板:Align |
{{tlg|x1|x<nowiki>=</nowiki>u}} | {{x1|x=u}} | 模板:Align |
{{tlg|x2||two||}} | {{x2||two||}} | empty parameters work too, even at the end |
{{tlg|x2|3=two|2=one}} | {{x2|one|two}} | 模板:Align |
提供模板連結的模板
[隐藏] | 連結形式 → | 含有連結 | 不含連結 | 含有連結並添加subst | 含有連結,連結包含括號 | 含有連結,顯示其他文字 | 含有連結,第一個| 替換成:
|
---|---|---|---|---|---|---|---|
文字樣式 ↓ | {{tlg}} 選項1
|
— | <syntaxhighlight lang="text" inline="">nolink=yes</syntaxhighlight> | <syntaxhighlight lang="text" inline="">subst=yes</syntaxhighlight> | <syntaxhighlight lang="text" inline="">braceinside=yes</syntaxhighlight> | <syntaxhighlight lang="text" inline="">alttext=FOO</syntaxhighlight> | 模板:N/A |
正常 | — | {{tl}} · {{tlp}} 2 · {{tlg}} 1, 2
|
{{tlf}} 2 · {{tnull}}
|
{{tls}} · {{tlsp}}
|
{{tn}}
|
{{tla}}
|
|
代碼 code
|
<syntaxhighlight lang="text" inline="">code=yes</syntaxhighlight> or <syntaxhighlight lang="text" inline="">tt=yes</syntaxhighlight> |
{{tlx}}
|
{{tlc}} 2 · {{tld}}
|
{{tlxs}}
|
{{tlxm}}
| ||
粗體 | <syntaxhighlight lang="text" inline="">bold=yes</syntaxhighlight> | {{tlb}}
|
|||||
粗體代碼 code
|
<syntaxhighlight lang="text" inline="">bold=yes|code=yes</syntaxhighlight> | {{tlxb}}
| |||||
斜體代碼 code
|
<syntaxhighlight lang="text" inline="">italic=yes|code=yes</syntaxhighlight> | {{tlxi}}
|
- 各顯示樣式的比較
{{tlf|Milford Haven Line|弘安源氏論議}}
→ {{Milford Haven Line|弘安源氏論議}}{{tld|Milford Haven Line|弘安源氏論議}}
→-{}-{{Milford Haven Line|弘安源氏論議}}
{{tlc|Milford Haven Line|弘安源氏論議}}
→{{Milford Haven Line|弘安源氏論議}}
- 添加參數
{{para|name|{{var|value}}}}
→|name=模板:Var
{{para|name|{{varserif|value}}}}
→|name=模板:Varserif
{{tlx|Milford Haven Line|參數1{{=}}賦值1}}
→{{Milford Haven Line|參數1=賦值1}}
參見