模板:Template link general
来自RIA | Wiki
更多操作
(重定向自模板:Tlg)
此模板, 通常缩写为 {{tlg}}, 用于在不实际使用模板本身的情况下为模板显示提供样式化的格式。
参数
除了 alttext, 命名参数是被忽略 (大多数情况下默认) 或激活的 (通过分配诸如 "on", "yes", "true", "include" 等值) 。 它们可以按任何顺序使用 (参见下面的示例) 。某些模板默认有参数 "on" ;
| 参数 | 行为 | 和 {{example}} 一起使用 |
默认值 |
|---|---|---|---|
| brace | 将大括号作为模板链接的一部分 | {{example}} | {{tlw}}/{{tn}} |
| braceinside | 将最内层的大括号作为模板链接的一部分 | {{example}} | |
| bold | 以粗体形式渲染模板链接/模板名 | {{example}} | {{tlb}}, {{tlxb}} |
| code | 将输出包裹在 <code>…</code> 标签中 (等宽字体) |
{{example}} |
{{tlc}}, {{Template link expanded}}, etc. |
| italic | 以斜体显示模板链接/模板名附带的所有参数 | {{example|param}} | {{tlxi}} |
| kbd | 将输出包裹在 <kbd>…</kbd> 标签中 (等宽字体) |
{{example}} | |
| nolink | 不链接模板名 | {{example}} | {{tlf}}, {{tnull}} |
| nowrap | 阻止输出的换行 (换行) | {{example}} | |
| nowrapname | 防止在模板名/链接的输出中换行 (如果需要, 模板参数会换行) | {{example}} | |
| plaincode | 使用 <code style="border: none; background: transparent;">…</code> |
{{example}} |
{{tltss}} |
| subst | 在模板链接/模板名前放置 subst: | {{subst:example}} | {{tls}}, {{tlxs}} 等 |
|alttext=[text] |
使用 [text] 作为模板链接的标签 | {{Other}} | {{tla}} |
未命名 (位置)
此模板可以将任意数量的未命名参数作为模板链接 (或名称) 的参数; 见下例。
示例
在来源姊妹项目中 (en.wikipedia 和 Meta) , X0、X1、X2、…、X9 是沙盒模板, 用于对需要在模板空间中的相关模板进行实验。存在一个自动清洁软件设施, 可用于在其他姐妹项目中复制该设施。
| 代码 | 输出 | 注释 |
|---|---|---|
{{Template link general|Banner}} |
{{Banner}} | Banner模板不存在。尽管示例中需要, 但请注意链接到不存在的模板。 |
{{Template link general|ok}} |
{{ok}} | ok 模板是存在的。 |
{{Template link general|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} |
{{convert|14|m|ftin|abbr=out|sp=us}} | 无限参数是一个 <nowiki>…</nowiki> 字符串
|
{{Template link general|Abc}} |
{{Abc}} | |
{{Template link general|abC}} |
{{abC}} | 模板名对大小写敏感 |
{{Template link general|abc}} |
{{abc}} | 模板名的首字母不区分大小写 |
{{Template link general|abc|{{spaces}}{{{1}}}{{spaces}}}} |
{{abc| {{{1}}} }} | 在 {{{1}}} 参数前后使用 {{spaces}}。 |
{{Template link general|x0}} |
{{x0}} | |
{{Template link general|x0|code=on}} |
{{x0}} |
<code> 样式 |
{{Template link general|x0|plaincode=on}} |
{{x0}} |
无装饰 code 样式 |
{{Template link general|x0|kbd=on}} |
{{x0}} | <kbd> 样式 |
{{Template link general|x0|bold=on}} |
{{x0}} | 粗体链接/名称 |
{{Template link general|x1|one|italic=on}} |
{{x1|one}} | 斜体参数 |
{{Template link general|x0|nolink=on}} |
{{x0}} | |
{{Template link general|x0|subst=on}} |
{{subst:x0}} | |
{{Template link general|x0|brace=on}} |
{{x0}} | 所有大括号都位于链接内 |
{{Template link general|x0|braceinside=on}} |
{{x0}} | 内部的大括号位于链接内 |
{{Template link general|x0|alttext=x0 link}} |
{{x0 link}} | |
{{Template link general|x0|bold=on|code=on|brace=on}} |
{{x0}} |
没有理由不能组合多个参数设置 |
{{Template link general|x1|one}} |
{{x1|one}} | |
{{Template link general|x2|one|two}} |
{{x2|one|two}} | |
{{Template link general|x2|bold=on|code=on|one|two}} |
{{x2|one|two}} |
可以组合命名参数和匿名参数… |
{{Template link general|x2|one|two|bold=on|code=on}} |
{{x2|one|two}} |
… 可以以任何顺序组合 … |
{{Template link general|x2|one|code=on|two|bold=on|three}} |
{{x2|one|two|three}} |
… 甚至混合在一起 … |
{{Template link general|x2|one|code=on|two|bold=on|three|italic=on}} |
{{x2|one|two|three}} |
… 有许多不同的配置。 |
{{Template link general|x3|1|2|3|4|5|6|7|8|9|10}} |
{{x3|1|2|3|4|5|6|7|8|9|10}} | |
{{Template link general}} |
Template link general | 如果不设置参数, 名称会被本模板的名称替代 |
{{Template link general|x1|x=u}} |
{{x1}} | = 不会起作用 |
{{Template link general|x1|x=u}} |
{{x1|x=u}} | = 是可以的
|
{{Template link general|x1|x{{=}}u}} |
{{x1|x=u}} | {{=}} 是可以的 (见 等号模板)
|
{{Template link general|x1|x<nowiki>=</nowiki>u}} |
{{x1|x=u}} | 粘贴 nowiki 也可以 |
{{Template link general|x2||two||}} |
{{x2|two}} | 即使在末尾, 空参数也会生效 |
{{Template link general|x2|3=two|2=one}} |
{{x2|one|two}} | 从右到左也是可能的 |
| 代码 | 输出 |
|---|---|
{{Template link general|long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
(长模板名称会换行至新行 | 第一个参数的长值会换行) |
{{long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}} |
| 代码 | 输出 |
|---|---|
{{Template link general|nowrap=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
|
{{long template name that would wrap to new line|long value for the 1st parameter that would wrap}} |
| 代码 | 输出 |
|---|---|
{{Template link general|nowrapname=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
|
{{long template name that would wrap to new line|long value for the 1st parameter that would wrap}} |
另见
通用格式
| 文本样式 ↓ | 实现文本样式的{{tlg}} 选项[note 1]
|
链接样式 | |||||
|---|---|---|---|---|---|---|---|
| 被链接 | 未被链接 | 被链接, 有替代 | 未被链接, 有替代 | 包括大括号的链接 | 可配置显示文本的链接 | ||
实现链接样式的{{tlg}} 选项[note 1]
|
不适用 | 默认 | nolink=yes
|
subst=yes
|
nolink=yes
|
braceinside=yes
|
alttext=Foo2=Foo
|
| 支持 | 默认 | {{tlg}} {{tl}} 模板:Tlp 模板:Tlu |
{{tlf}} <模板链接> |
模板:Tls 模板:Tlsu |
{{tlsf}} <模板链接> |
模板:Tn | 模板:Tla |
计算机代码
|
code=yes
|
模板:Tl2{{tlx}}模板:Tlxu |
{{tlc}}<模板链接> {{tnull}}<模板链接>
|
模板:Tlxs | 模板:Tlsc <模板链接> |
不适用 | |
| 等宽字体 | plaincode=yes |
不适用 | 模板:Tltss |
不适用 | |||
| 键盘输入 | kbd=yes | ||||||
| 粗体 | bold=yes
|
模板:Tlb | 不适用 | ||||
粗体计算机代码
|
bold=yes
|
模板:Tlxb | |||||
斜体计算机代码
|
italic=yes
|
模板:Tlxi | |||||
- ↑ 1.0 1.1 1.2
{{tlg}}是最通用的模板, 允许文本样式和/或链接样式选项的任意组合。 - ↑ 2.0 2.1 2.2 2.3 2.4 通过将文本放置在
<span class="nowrap">…</span>标签内来防止文本换行。 - ↑ 3.0 3.1 3.2 允许链接到任何命名空间中的模板。
- ↑ 模板:Tld 使用
<code style="border: none; background-color: transparent;">…</code>。 - ↑ 5.0 5.1 使用
<span style="font-family: monospace;">…</span>显示等宽字体。
其他格式化模板
| 代码示例 | 效果 | 注释 |
|---|---|---|
{{tl2|Hatnote|lang=fr}}
|
模板:Tl2 | 姊妹项目链接 (例如: fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
模板:Tlu | 支持从任意命名空间链接 |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
模板:Demo | 显示代码和示例 |
{{xpd|Hatnote|Some hatnote text}}
|
模板:Xpd | Shows code, example and a link to expand the template code 显示代码、示例, 并在其后添加查看展开后模板代码的链接 |
{{tln|Hatnote}}
|
模板:Tln | 生成链接到模板的普通链接 |
{{elc|Template:Hatnote}}{{elc|Template:Hatnote|Hatnote}}
|
模板:Elc 模板:Elc |
格式化 wiki 链接, 可选管道链接文本和混合后缀 |
{{ml|Example|hello}}
|
模板:Ml | 用于链接到 Lua 模块, 与 {{tl}} 对应 |
{{mlx|Example|hello}}
|
模板:Mlx | 用于链接到 Lua 模块, 与 {{tlx}} 对应 |
{{para|title|<var>book title</var>}}
|
|title=book title |
用于格式化显示的模板参数, 能够带值或不带值 |
{{sclx|LASTING}}
|
模板:Sclx | 在项目名称空间中接受一个快捷后缀, 用包裹在 <code>…</code> 和中括号内的WP:alias显示它
|
{{tag|ref}}{{xtag|templatedata}}
|
<ref>…</ref>模板:Xtag |
格式化 [X]HTML 标签; 可以添加内容, 也有只显示开始标签、结束标签和显示自闭合标签的选项 |
{{dtl|Ping project}}
|
模板:Dtl | 链接到 Wikidata, 与 {{tl}} 对应 |
{{pf|if}}{{pf|if|{{{1}}}|true|false}}
|
模板:Pf 模板:Pf |
链接到解析器函数, 与{{tl}} 对应 |
{{magic word|uc:}}
|
模板:Magic word | 魔术字链接 |
带有实用链接
| 代码示例 | 效果 |
|---|---|
{{lt|Hatnote}}
|
模板:Lt |
{{lts|Hatnote}}
|
模板:Lts |
{{t links|Hatnote}}
|
模板:T links |
{{tfd links|Hatnote}}
|
模板:Tfd links |
{{tetl|Hatnote}}
|
模板:Tetl |
{{tsetl|Hatnote}}
|
模板:Tsetl |
{{ti|Hatnote}}
|
模板:Ti |
{{tic|Hatnote}}
|
模板:Tic |
{{tim|Hatnote}}
|
模板:Tim |
{{tiw|Hatnote}}
|
模板:Tiw |
{{tlt|Hatnote}}
|
模板:Tlt |
{{ttl|Hatnote}}
|
模板:Ttl |
{{twlh|Hatnote}}
|
模板:Twlh |