Difference between revisions of "Template:C"
Jump to navigation
Jump to search
Mediawiki>Ahecht (rm #titleparts) |
Mediawiki>Sarang m (expansion) |
||
Line 1: | Line 1: | ||
− | [[:Category:{{PAGENAME:{{{1}}}}}|{{{2|{{PAGENAME:{{{1}}}}}}}}]]<noinclude> | + | {{#switch:G|{{{2}}}|{{{3}}}|{{{4}}}=[[Category:{{PAGENAME:{{{1}}}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<!-- Category generation |
− | {{ | + | -->|{{#switch:-|{{{2}}}|{{{3}}}|{{{4}}}={{#switch:+|{{{2}}}|{{{3}}}|{{{4}}}=|Category:}}}}<!-- namespace (not linked) |
+ | -->{{#switch:{{{link}}}|n|none={{{1|}}}|<!-- | ||
+ | -->{{#switch:{{{3|}}}|-|+|={{#ifeq:{{PAGENAME:{{{1}}}}}|{{{1}}}|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- standard: commons | ||
+ | with namespace: | ||
+ | -->|{{#ifexist:Category:{{PAGENAME:{{{1}}}}}|[[:Category:{{PAGENAME:{{{1}}}}}|{{C/display|{{PAGENAME:{{{1}}}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexist:Category:{{{1}}}|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | {{#ifeq:{{NAMESPACENUMBER:{{{1}}}}}|10||[[Category:Commons:PagenameCategories]]}} | ||
+ | -->|[[:Category:{{{1}}}|''{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}'']] }}}}}}<!-- | ||
+ | with B: | ||
+ | -->|B=[[:Category:{{{1}}}|[[{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]]]<!-- only standard: [[commons]] | ||
+ | |||
+ | with X|x: | ||
+ | -->|X|x={{#ifeq:{{PAGENAME:{{{1}}}}}|{{{1}}}<!-- | ||
+ | -->|{{#ifexist:Category:{{{1}}}|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexpr:{{PAGESINCATEGORY:{{{1|}}}}}>0|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifeq:{{{3}}}|X|<span style="background-color:#FEDBCA">{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}</span><!-- | ||
+ | -->|[[''Category'':{{#ifeq:{{{3}}}|x|<span style="color:red">}}{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}{{#ifeq:{{{3|}}}|x|</span>}}]]}}}}}}<!-- | ||
+ | with X|x and namespace | ||
+ | -->|{{#ifexist:Category:{{PAGENAME:{{{1}}}}}|[[:Category:{{PAGENAME:{{{1}}}}}|{{C/display|{{PAGENAME:{{{1}}}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexist:Category:{{{1}}}|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexpr:{{PAGESINCATEGORY:{{{1|}}}}}>0|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexpr:{{PAGESINCATEGORY:{{PAGENAME:{{{1|}}}}}}}>0|[[:Category:{{PAGENAME:{{{1}}}}}|{{C/display|{{PAGENAME:{{{1}}}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifexist:Category:{{{1}}}|[[:Category:{{{1}}}|{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]<!-- | ||
+ | -->|{{#ifeq:{{{3}}}|X|<span style="background-color:#FEDBCA">{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}</span><!-- | ||
+ | -->|[[''Category'':{{#ifeq:{{{3}}}|x|<span style="color:red">}}{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}{{#ifeq:{{{3|}}}|x|</span>}}]]}}}}}}}}}}}}}}<!-- | ||
+ | |||
+ | not commons: take it as it is | ||
+ | -->|#default=[[:{{{3}}}:Category:{{{1}}}{{!}}{{C/display|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}]]}}}}}}<noinclude> | ||
+ | {{documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 09:29, 30 April 2019
[[:Category:{{{1}}}|{{{1}}}]]
This documentation is transcluded from Template:C/doc.
Usage
Use {{c}} to create a namespace-free link to a category, e.g. Philosophy rather than Category:Philosophy, Template:Cls:
- {{c|Philosophy}} produces: Philosophy
- {{c|Category:philosophy}} produces: Philosophy
To specify the text used for the link – e.g. "Philosophy category" in place of "Philosophy" – add it as the next parameter:
- {{c|Philosophy|Philosophy category}} produces: Philosophy category
- {{c|Category:philosophy|Philosophy category}} produces: Philosophy category
See also
- {{cl}}, which produces the second type of link shown in the Usage section (Category:Philosophy, i.e. including the namespace prefix).
- {{cls}}, which produces the third type shown in the Usage section (Template:Cls, i.e. including an abbreviated namespace prefix).
- {{lcs}}, which produces output such as: (edit talk links history)
- {{icon}} for standard Wikipedia icons.
Template:Internal category-link templates
Template data
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.
TemplateData for C
Creates links to categories without the namespace prefix.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Category name | 1 | The name of the category to link to, with or without the Category: prefix | String | required |
Link text | 2 | Text of the actual link, if you want to override it | String | optional |