Template:BookCat/doc
Template:Documentation subpage Template:Possible-risk
This template puts the page on which it's used ({{FULLPAGENAME}}
) into appropriate categories, based on certain page-naming and page-categorization conventions.
Usage
When used without parameters, it
- places subpages of a book in the book's category (Template:Nowrap) and sorts them by chapter name.
- places a book's templates in the book's template category (Template:Nowrap). This only does the right thing if a book's templates begin with Template:Nowrap .
- places a book's template category in the book's category and in Template:Nowrap .
- places any other category in its parent, sorted by the category's last name. The parent has the same name except removing everything from the last slash on; and the last name is the part that was removed after that last slash. For example, Template:Nowrap would go in Template:Nowrap with sort key
Images
.
Parameters
Optional parameter Template:Nowrap changes the behavior on book pages, so that a book page with more than one slash in its name is placed in a subcategory of the category where its parent page would be placed, sorted by the page's last name. For example, using Template:Nowrap on page Template:Nowrap would put that page in Template:Nowrap with sort key Asia
.
Optional parameter Template:Nowrap changes the behavior on template pages to deep filing (so Template:Nowrap would go in Template:Nowrap).
Optional parameter sort
or sortkey
specifies a sort key to be used for categorization instead of relying on Template:Tl.
Optional first unnamed parameter is a full page name to use instead of the {{FULLPAGENAME}}
of the current page.
An alternative template Template:Tl reports the output of Template:Tl (with or without parameters) as an inert string, rather than categorizing the current page.
Eamples
Template:Magic word templates/book page examples
Internals
This template itself only contains the logic to sort out the identity of the target page; deducing the appropriate categorization is then delegated to Template:Tl. As of this writing, parameters assembled here are namespace
, pagename
, fullpagename
, and sortkey
; the first unnamed parameter is removed, and all other parameters are passed through to the subtemplate.
See also
- See Using Wikibooks/Subjects, Categories, and Classifications#Deep filing (advanced) for more information.
- Instances are listed at
- Template:Tl is closely related.