Template:Category handler

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
(Redirected from Template:Ctg)
Jump to navigation Jump to search
Template documentation
This documentation is transcluded from Template:Category handler/doc. [edit] [history] [purge]
Template:Category handler invokes function main in Module:Category handler using Lua.
Shortcut:

Adds every category listed in the unnamed parameters to the page it is used on. This handler also includes built in sorting mechanics:

  • Pages that match the category name exactly will be sorted as [[Category:<category>| ]], placing them at the front of the category.
    • This rule also applies to titles that are simple plurals of each other; e.g. Episode and Episodes
  • Pages that begin with the category will be sorted with the beginning removed.
    • Subpages are handled similarly; e.g. Iron Man/History will be sorted as [[Category:Iron Man|History]]

This template is not a tool that should be used directly on pages, as it is more efficient for the page itself to use standard categorization. The main purpose of this tool is to provide categorization rules for navboxes to mass categorise and sort pages.

Usage
{{Ctg|Category 1|Category 2|...}}
Example
{{Ctg|Episodes|July 4 media}}

Placed on most pages, this would produce

[[Category:|Episodes]][[Category:July 4 media]].

On the page Episodes, however, it would produce

[[Category:July 4 media]][[Category:Episodes| ]].

Modifiers

These are modifiers that can be used (in any order and amount) by appending them after the category name.

Important notes for all modifiers
Several characters cannot be used in the text patterns:
  1. Percent signs (%)
  2. Colons (:)
  3. Brackets ([ and ])
All matches are case insensitive
e.g.; "episode" will match for all of "EpisodE", "EPISOdESSS", and "EEPISODE"

::ifmatches

The ::ifmatches modifier will tell the module to only add the specific category if all or part of the pagename matches the category name.

::ifmatches[text]

The ::ifmatches[text] modifier will tell the module to only add the specific category if all or part of the pagename matches the text passed.

With ::ifmatches, multiple match rules can be defined with multiple sets of brackets. For example, ::ifmatches[rune][whip] will match any page that has either "rune" or "whip" in the title. In the rare cases where it may be necessary to have more than a few matches, they can be formatted with spaces and newlines.

::remove[text]

The ::remove[text] will tell the module to remove the text argument from the beginning of pagenames to use as their sort key. If this function is not specified, then the category's name exactly will be used. Likewise, defining this function will not remove the category name from pages for sorting; however, it will still sort exact matches to the front.

If a pagename matches the text to remove exactly, then it will be sorted to the front.

The remove function can be suppressed by using a junk character (such as $). This will not suppress the front sort for exact title matches.