Template:Shelf:Page/doc
This is a documentation subpage for Template:Shelf:Page It contains usage information, categories and other content that is not part of the original template page. |
Usage
editUse this template on a shelf page in the Wikibooks Stacks; everything on the shelf page other than the template call should be noinclude
d.
The template primarily performs one of two functions. It can provide a detailed display of information about the shelf, including its description, its parents, its children (immediate subshelves), and all the books on the shelf or any of its descendants classified by stage of completion; or, it can provide a wikilisp-formatted list of parents of the shelf. The parentage function is performed whenever the shelf page is transcluded onto any page whose PAGENAME
does not have prefix Shelf:
, and also when invoked by unnamed parameter (below). Only if PAGENAME
has the prefix and is not overridden by parameter, the template performs its display function.
Parents can be either shelves or departments (the top-level classifications of books in the Wikibooks Stacks). The corresponding template for departments is {{Department:Page}}.
Parameters
editparent
: specifies a parent shelf or department, of which this shelf is a subset.parent2
: optional, specifies a second parent shelf or department.description
: specifies the description of the subject matter the shelf covers.namespace
: optional, specifies which namespace should be searched through for books; defaults to the main namespace.1
: needs to be passed through from the shelf page to this template, otherwise it would not be possible for a transcluding page to override the display function.
Cosmetic parameters, less often used:
maxcount
: optional, specifies a requested maximum length of the book lists; default is the maximum supported directly by the extension (as of this writing, 200); request a larger number if it may be required for this shelf; see {{DPL}}.theme
: optional, specifies the {{Robox}} theme for the description box; defaults to 15.theme2
: optional, specifies the {{Robox}} theme for the books box; defaults to 3.icon
: optional, specifies the logo displayed in the description box without theFile:
included; defaults to the Wikibooks logo.iconwidth
: optional, specifies the width of the logo displayed in the description box withpx
included; defaults to 45px.
Copy-paste
editCommonly-used | Full |
---|---|
{{Shelf:Page |parent= |description= |1={{{1|}}} }} |
{{Shelf:Page |parent= |parent2= |description= |namespace= |1={{{1|}}} |maxcount= |theme= |theme2= |icon= |iconwidth= }} |
Internals
editThis template itself determines which sort of information request is being made, and either provides information directly, or delegates the display function to {{Shelf:Page/display}}. Delegation is done using Module:TScope#override, so that the subtemplate can tell which parameters were not provided, in order to supply default values for them.
When the transcluding page has PAGENAME
prefix Shelf:
and is not overridden by a non-blank first unnamed parameter, this template delegates to produce a full display. If the first unnamed parameter is ping
, this template returns Shelf:Page
. Otherwise, it produces a list of quoted strings, suitable for parsing via {{evalx}}. Before attempting to extract the parents this way, a calling page should verify correct format of the result by checking that {{evalx}} recognized the result as a non-empty list; if the format doesn't verify, the caller should report the problem to Category:Book:Wikibooks Stacks/Attention needed.
The maximum number of parents per shelf is meant to be hardcoded only into this template and its subtemplates; if one ever needed to adjust that maximum, they should be the only templates directly involved. See also {{Shelf:Map}}.