Template:Category see also if exists/doc:修订间差异

删除的内容 添加的内容
无编辑摘要
填充 doc 内容
第1行:
{{Documentation subpage}}<!-- 在本行下编辑模板说明 -->
<!-- 在本行下编辑模板说明 -->
{{lua|Module:SeeCategory see also if exists}}
 
此模板用于生成"参见"分类的顶注,仅列出'''实际存在'''的分类页面。
 
== 用法 ==
<pre>{{Category see also if exists|分类1|分类2|...}}</pre>
 
== 参数 ==
<includeonly>{{sandbox other||
; 位置参数(可多个)
: 分类名称。可带或不带 <code>Category:</code> 前缀。
 
== 示例 ==
{| class="wikitable"
|-
! 代码 !! 输出
|-
| <code><nowiki>{{Category see also if exists|中药|方剂}}</nowiki></code> || 若两者均存在:参见:[[:Category:中药]]、[[:Category:方剂]]
|-
| <code><nowiki>{{Category see also if exists|不存在的分类}}</nowiki></code> || ''(空)''
|}
 
== 工作原理 ==
调用 [[Module:Category see also if exists]],遍历所有参数,用 <code>mw.title.exists</code> 检查分类是否存在,仅输出存在的分类。
 
== 参见 ==
* [[Module:Category see also if exists]]
{{Hatnote templates}}
 
<includeonly>{{sandbox other||
[[Category:顶注模板]]
}}</includeonly>