Template:Shelf:Page/doc

Usage
Use this template on a shelf page in the ; everything on the shelf page other than the template call should be 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  does not have prefix , and also when invoked by unnamed parameter (below). Only if  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
Cosmetic parameters, less often used:
 * : specifies a parent shelf or department, of which this shelf is a subset.
 * : optional, specifies a second parent shelf or department.
 * : specifies the description of the subject matter the shelf covers.
 * : optional, specifies which namespace should be searched through for books; defaults to the main namespace.
 * : 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.
 * : 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.
 * : optional, specifies the Robox theme for the description box; defaults to 15.
 * : optional, specifies the Robox theme for the books box; defaults to 3.
 * : optional, specifies the logo displayed in the description box without the  included; defaults to the Wikibooks logo.
 * : optional, specifies the width of the logo displayed in the description box with  included; defaults to 45px.

Internals
This 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, so that the subtemplate can tell which parameters were not provided, in order to supply default values for them.

When the transcluding page has  prefix   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, this template returns. 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 /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.