跳转到内容

Template:Category pair/doc:修订间差异

维基百科,自由的百科全书
删除的内容 添加的内容
N-C16 已移動頁面 Template:CatPair/docTemplate:Category pair/doc
无编辑摘要
第1行: 第1行:
{{Documentation subpage}}
<includeonly><!-- 在這裡加入模板的保護標識 --></includeonly><noinclude>{{template doc page viewed directly}}</noinclude>
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- 在本行下編輯模板說明 -->
== 模板介紹 ==


== 使用方法 ==
==Usage==
Place
* {{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2}}
on the top of the category page, replacing "<code>CATEGORY NAMEn</code>" with the ''names only'' of the target categories, leaving out the term "<code>Category:</code>".


Each category is displayed only if it exists. If neither category exists, nothing will be displayed.
== 範例 ==


If there is no succeeding category, you may simply place:
== 注意事项 ==
* {{tlx|Category pair|CATEGORY NAME1}}
on the top of the category page, replacing "<code>CATEGORY NAME1</code>" with the ''name only'' of the target category, leaving out the term "<code>Category:</code>".


If there is no preceding category, then leave the first parameter empty, and simply place:
== 參見 ==
* {{tlx|Category pair|<nowiki> </nowiki>|CATEGORY NAME2}}
on the top of the category page, replacing "<code>CATEGORY NAME2</code>" with the ''name only'' of the target category, leaving out the term "<code>Category:</code>".


==Examples==
== 给模板编辑者的说明 ==
;Preceding and succeeding categories, both exist
=== 模板结构 ===
* {{tlx|Category pair|19th century|21st century}} → {{Category pair|19th century|21st century}}
=== 实现方法 ===
* {{tlx|Category pair|20th century|22nd century}} → {{Category pair|20th century|22nd century}}
=== 编辑注意 ===
;Preceding category only, which exists
* {{tlx|Category pair|20th century}} → {{Category pair|20th century}}
;Succeding category only, which exists
* {{tlx|Category pair|<nowiki></nowiki>|5th century}} → {{Category pair||5th century}}
;Preceding and succeeding categories, only preceding exists
* {{tlx|Category pair|7th century|Nth century}} → {{Category pair|7th century|Nth century}}
;Preceding and succeeding categories, only succeeding exists
* {{tlx|Category pair|Xth century|5th century}} → {{Category pair|Xth century|5th century}}
; Two non-existent categories, so no output:
* {{tlx|Category pair|81st century|83rd century}} → {{Category pair|81st century|83rd century}}


== Error checking ==
<includeonly>
If more than two parameters are supplied, a warning message is shown when the page is previewed and when it is saved the page is added to a hidden tracking category: [[:Category:Pages using Template:Category pair with more than 2 parameters]].
[[Category:分類頁模板]]
[[Category:内部链接模板]]


Only the first two parameters are processed. Others are ignored.
[[bn:টেমপ্লেট:Category pair]]

[[en:Template:Category pair]]
If more than two parameters are supplied, the template is unlikely to do what the editor intended e.g.
[[mk:Шаблон:КатПар]]
* <code><nowiki>{{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2|CATEGORY NAME3}}</nowiki></code> will ignore CATEGORY NAME3
[[ro:Format:CatPereche]]
* <code><nowiki>{{tlx|Category pair|CATEGORY NAME1||CATEGORY NAME2}}</nowiki></code> will ignore CATEGORY NAME2, because a duplicate <code>|</code> character between the two categories causes CATEGORY NAME2 to be the third parameter rather the second
[[tl:Suleras:CatPair]]

[[tr:Şablon:ÖnceVeSonraKat]]
== Tracking categories ==
[[ur:سانچہ:Category pair]]
* [[:Category:category pair没有输出的页面]]
: If neither parameter is a category which currently exists the template will produce no output. This is ''not necessarily an error''; the other categories may simply be part of an incomplete series which will be completed in due course
* [[:Category:category pair参数超过2个的页面]]
: See above: [[#Error checking|Error checking]]

==See also==
* {{tl|Preceding category}}
* {{tl|Succeeding category}}
* {{tl|Category see also}}
* {{tl|Category see also if exists}}

<includeonly>{{sandbox other||
[[Category:内部类链接模板]]
[[Category:分类页面顶注模板]]
}}
</includeonly>
</includeonly>

2018年10月11日 (四) 13:14的版本

Usage

Place

on the top of the category page, replacing "CATEGORY NAMEn" with the names only of the target categories, leaving out the term "Category:".

Each category is displayed only if it exists. If neither category exists, nothing will be displayed.

If there is no succeeding category, you may simply place:

on the top of the category page, replacing "CATEGORY NAME1" with the name only of the target category, leaving out the term "Category:".

If there is no preceding category, then leave the first parameter empty, and simply place:

on the top of the category page, replacing "CATEGORY NAME2" with the name only of the target category, leaving out the term "Category:".

Examples

Preceding and succeeding categories, both exist
Preceding category only, which exists
Succeding category only, which exists
Preceding and succeeding categories, only preceding exists
Preceding and succeeding categories, only succeeding exists
Two non-existent categories, so no output

Error checking

If more than two parameters are supplied, a warning message is shown when the page is previewed and when it is saved the page is added to a hidden tracking category: Category:Pages using Template:Category pair with more than 2 parameters.

Only the first two parameters are processed. Others are ignored.

If more than two parameters are supplied, the template is unlikely to do what the editor intended e.g.

  • {{tlx|Category pair|CATEGORY NAME1|CATEGORY NAME2|CATEGORY NAME3}} will ignore CATEGORY NAME3
  • {{tlx|Category pair|CATEGORY NAME1||CATEGORY NAME2}} will ignore CATEGORY NAME2, because a duplicate | character between the two categories causes CATEGORY NAME2 to be the third parameter rather the second

Tracking categories

If neither parameter is a category which currently exists the template will produce no output. This is not necessarily an error; the other categories may simply be part of an incomplete series which will be completed in due course
See above: Error checking

See also