Template:catboiler/documentation

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
Edit-copy green.svg Documentation for Template:catboiler. [edit]
This page contains usage information, categories, interwiki links and other content describing the template.

This template is a helper template for generating category boilerplate templates. It is not meant to be used directly, but is to be used by a more specific template such as {{poscatboiler}}.

Parameters[edit]

This template and its subtemplates have various parameters which are passed in between them. Most of the subtemplates share a common set:

  • temp= The name of the specific template that uses the catboiler system.
  • code= The code that specifies what 'owns' the category's contents. This is usually a language code such as en, but it can also be a script code like Latn or the code of a language family.
  • label= A name for the thing that is being categorised. How the label is interpreted depends on the label subtemplate's properties, and it could be anything at all in theory. This name is used internally, and is also used as the name of the category unless the label's mask property overrides this. The "top level" label, which is used when no label is given, is always called ROOT.
  • sc= The script of the items to be categorised. This is usually empty, but many categories such as those used by Mandarin Chinese can split into subcategories based on script.

General workings[edit]

The catboiler template system distinguishes three kinds of category.

Every template that uses {{catboiler}} should have a subtemplate called /CONFIG. The /CONFIG template must contain a switch that returns different values depending on the first parameter. Something like the following, for {{poscatboiler}}:

{{#switch:{{{1|doc}}}<!--
-->|umbrella-categorization=fundamental<!--

-->|basic={{#if:{{{label}}}|{{#invoke:language utilities|lookup_language|{{{code}}}|names}} {{poscatboiler/{{{label}}}|mask|code={{{code}}}|label={{{label}}}|sc={{{sc}}}}}}}<!--
-->|umbrella={{#if:{{{label}}}|{{poscatboiler/{{{label}}}|mask|code={{{code}}}|label={{{label}}}|sc={{{sc}}}}} by language}}<!--
-->|fundamental=All parts of speech<!--

-->|doc=<!--
-->|edit=poscatboiler/{{#if:{{{label}}}|{{{label}}}|CONFIG}}<!--
-->|#default={{#if:{{{label}}}|{{poscatboiler/{{{label}}}|{{{1}}}|code={{{code}}}|label={{{label}}}|sc={{{sc}}}}}}}<!--
-->}}

The different properties are as follows:

umbrella-categorization=
How umbrella categories are to be categorized.
fundamental
Categorize all umbrella categories into a single fundamental category. The umbrella category of the ROOT is sorted with **.
parallel
Categorize each umbrella category into the umbrella category of its parent, according to the label. This causes the umbrella categories to follow the same tree structure as the code-specific categories, and no fundamental category is used (it is just the root umbrella category instead). Each umbrella category will contain both the code-specific categories of its label and the umbrella categories of its child labels.
basic=
Returns a "basic" category name. Usually, the code is converted to a language name, and this is then followed by the label's mask. But it's also possible to use other formats if desired.
umbrella=
Returns an "umbrella" category name. Usually, the label's mask is appended with "by language", but other formats can also be used.
fundamental=
Returns the "fundamental" category name. This is only needed if the template's category structure uses a fundamental category (i.e. when umbrella-categorization=fundamental).
doc=
Some text to document the /CONFIG template itself, if necessary.
edit=
Return the name of the template that should be edited for a given label. This is used to generate an "edit" link on each category, so that users can easily change the settings of a particular label if necessary.
#default=
This should normally "forward" any unrecognised properties to another subtemplate. Most templates will use a subtemplate with the same name as the label, but there are other possibilities (as for {{derivcatboiler}}).

The "forwarding", as noted above, generally uses one subtemplate for each label. So, for example, the label nouns for the template {{poscatboiler}} would use a subtemplate called {{poscatboiler/nouns}}. Each subtemplate defines its own settings for that specific label, and this is useful if there is no systematic way to decide what the contents of each category should be or what its parents are. If a category is created that does not have a corresponding subtemplate, an error is shown with a link to the missing subtemplate. The subtemplate for the ROOT label is named ROOT and must always be present.

It's also possible to use a more procedural method of determining which subtemplate to use. {{derivcatboiler}}, for example, uses only two, {{derivcatboiler/ROOT}} for the ROOT label, and {{derivcatboiler/OTHER}} for all other labels. The latter contains more elaborate code to generate parent categories and descriptions.

The subtemplates themselves use {{catboiler helper}}, which supports additional properties.

Subtemplates[edit]

The following are the main subtemplates called directly by catboiler.

These categories are supplemental and are used in various places throughout the catboiler template system.