ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Template:Categ: Difference between revisions

From ModEnc
Jump to navigation Jump to search
m Improving a fix
m Woopsie
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifexist:Category:{{{1}}} Flags|[[:Category:{{{1}}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{{1}}} Flags]]|{{#ifexist:Category:{{#sub:{{{1}}}|0|-1}} Flags|[[:Category:{{#sub:{{{1}}}|0|-1}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{#sub:{{{1}}}|0|-1}} Flags]]|[[:Category:{{{1}}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{{1}}} Flags]]}}}}</includeonly> <noinclude>This template turns the text into a category link and adds the page to that category. Intented to be used inside Flag template to autolink the page to certain subsets of [[:Category:INI_Flags]]. Usage:<pre>{{Categ|Example}}</pre> will create a link to <tt>Category:Example_Flags</tt> titled <tt>Example</tt> and add the page to that category. <pre>{{Categ|Example|SmartName}}</pre> will create a link to <tt>Category:Example_Flags</tt> titled <tt>SmartName</tt> and add the page to that category. </noinclude>
<onlyinclude>{{ #if: {{{ini|}}}
|[[{{{ini}}}.ini|{{{1|{{ini|{{{ini}}}|text}}}}}]][[Category:{{ini|{{{ini}}}|text}}_Flags]]
|{{ #switch: {{{1}}}
|AllTechnoTypes|AllTechnos|AllTechnoes|Technos|Technoes=
[[TechnoTypes]][[Category:TechnoTypes_Flags]]:
[[AircraftTypes]][[Category:AircraftTypes_Flags]],
[[BuildingTypes]][[Category:BuildingTypes_Flags]],
[[InfantryTypes]][[Category:InfantryTypes_Flags]]
and [[VehicleTypes]][[Category:VehicleTypes_Flags]]
|Objects=
[[TechnoTypes]][[Category:TechnoTypes_Flags]]: [[AircraftTypes]][[Category:AircraftTypes_Flags]], [[BuildingTypes]][[Category:BuildingTypes_Flags]], [[InfantryTypes]][[Category:InfantryTypes_Flags]] and [[VehicleTypes]][[Category:VehicleTypes_Flags]] <br>as well as [[ObjectTypes]][[Category:ObjectTypes_Flags]]: [[Animations]][[Category:Animations_Flags]], [[Projectiles]][[Category:Projectile_Flags]], [[TMPTiles]][[Category:TMPTiles_Flags]], [[OverlayTypes]][[Category:OverlayTypes_Flags]], [[ParticleSystems]][[Category:ParticleSystems_Flags]], [[Particles]][[Category:Particles_Flags]], [[SmudgeTypes]][[Category:SmudgeTypes_Flags]], [[TerrainTypes]][[Category:TerrainTypes_Flags]] and [[VoxelAnimTypes]][[Category:VoxelAnimTypes_Flags]]
|#default=
{{#ifexist: Category:{{{1}}}_Flags
|[[{{{1}}}|{{{2|{{{1}}}}}}]][[Category:{{{1}}}_Flags]]
|{{ #ifexist: Category:{{ #sub:{{{1}}}|0|-1}}_Flags
|[[{{{1}}}|{{{2|{{{1}}}}}}]][[Category:{{ #sub:{{{1}}}|0|-1}}_Flags]]
|[[{{{1}}}_Flags|{{{2|{{{1}}}}}}]][[Category:{{{1}}}_Flags]]
}}
}}
}}
}}</onlyinclude>
This template creates a link and adds the page to the appropriate subcategory of [[:Category:INI_Flags]].
 
==Usage==
This is intented to be used with [[Template:Flag]] to link to certain pages, while adding the flags categories as well. It is not meant to be used as a shortcut for writing out a link to a category page.
 
===For <nowiki>{{{types}}}</nowiki> in Template:Flag===
Certain titles of subcategories of [[:Category:INI_Flags]] exclude the terminating "s" that is present in the corresponding article's page. For example, the title of [[Warheads]] contains a terminating "s", while [[:Category:Warhead_Flags]] does not. Although <code><nowiki>{{Categ|Warhead|Warheads}}</nowiki></code> would function correctly, this template automatically accounts for the terminating "s" if <code><nowiki>{{Categ|Warheads}}</nowiki></code> were used instead.{{fnl|1}}
 
<pre>{{Categ|InfantryTypes}}</pre>
This code yields [[InfantryTypes]] and includes the page in [[:Category:InfantryTypes_Flags]].
 
Should customized hypertext be necessary, <nowiki>{{{2}}}</nowiki> can be used:
<pre>{{Categ|InfantryTypes|infantry}}</pre>
This code yields [[InfantryTypes|infantry]] and includes the page in [[:Category:InfantryTypes_Flags]].
 
====TechnoTypes====
<pre>{{Categ|Technoes}}</pre>
This is a special case that generates categories and links for [[TechnoTypes]], as well as the four subclasses. This should be used instead of <code><nowiki>{{Categ|TechnoTypes}}</nowiki></code>. Other parameter values that achieve this effect are <code>Technos</code>, <code>AllTechnoes</code>, <code>AllTechnos</code>, and <code>AllTechnoTypes</code>.
 
===For <nowiki>{{{files}}}</nowiki> in Template:Flag===
When this template is used for the value of <nowiki>{{{files}}}</nowiki> in [[Template:Flag]], <nowiki>{{{ini}}}</nowiki> should be used to specify the correct ini-file.
 
<pre>{{Categ|ini=art}}</pre>
This code yields {{ini|art}} and includes the page in [[:Category:{{ini|art|text}}_Flags]].
 
Should customized hypertext be necessary, <nowiki>{{{1}}}</nowiki> can be used:
<pre>{{Categ|ini=art|art}}</pre>
This code yields [[Art.ini|art]] and includes the page in [[:Category:{{ini|art|text}}_Flags]].
 
==Notes==
{{fn|1|This template is automagically delicious.}}

Latest revision as of 19:16, 10 June 2008

[[{{{1}}}_Flags|{{{1}}}]][[Category:{{{1}}}_Flags]] This template creates a link and adds the page to the appropriate subcategory of Category:INI_Flags.

Usage

This is intented to be used with Template:Flag to link to certain pages, while adding the flags categories as well. It is not meant to be used as a shortcut for writing out a link to a category page.

For {{{types}}} in Template:Flag

Certain titles of subcategories of Category:INI_Flags exclude the terminating "s" that is present in the corresponding article's page. For example, the title of Warheads contains a terminating "s", while Category:Warhead_Flags does not. Although {{Categ|Warhead|Warheads}} would function correctly, this template automatically accounts for the terminating "s" if {{Categ|Warheads}} were used instead.1

{{Categ|InfantryTypes}}

This code yields InfantryTypes and includes the page in Category:InfantryTypes_Flags.

Should customized hypertext be necessary, {{{2}}} can be used:

{{Categ|InfantryTypes|infantry}}

This code yields infantry and includes the page in Category:InfantryTypes_Flags.

TechnoTypes

{{Categ|Technoes}}

This is a special case that generates categories and links for TechnoTypes, as well as the four subclasses. This should be used instead of {{Categ|TechnoTypes}}. Other parameter values that achieve this effect are Technos, AllTechnoes, AllTechnos, and AllTechnoTypes.

For {{{files}}} in Template:Flag

When this template is used for the value of {{{files}}} in Template:Flag, {{{ini}}} should be used to specify the correct ini-file.

{{Categ|ini=art}}

This code yields art(md).ini and includes the page in Category:art(md).ini_Flags.

Should customized hypertext be necessary, {{{1}}} can be used:

{{Categ|ini=art|art}}

This code yields art and includes the page in Category:art(md).ini_Flags.

Notes

1 This template is automagically delicious.