Template:Root subject

From Wikibooks, open books for an open world
Jump to: navigation, search

< Books by subject

Wikibooks-logo.svg
Root subject
{{{description}}}
Chart organisation.svg
Subsections
Star*.svg
Featured Books
Category:Subject:Root subject
Template documentation[edit] [history] [purge]

This template is used on top-level subject pages to list books within that subject's respective category. Used on a subject page, it also handles queries to the subject page from other pages. Use {{subject page}} for regular subjects.

Usage

Parameters, of which only the first is required:

  • description: specifies the description of the subject area the page will cover
  • featuredbooks: alternative to an automatically generated list, specifies a list of featured books in the sub-subjects of this top-level subject as an HTML unordered list (<ul><li>[[Book]]</li><li>[[Book2]]</li></ul>)
  • namespace: optional, specifies which namespace should be searched through for books; defaults to the main namespace
  • theme: optional, specifies the {{Robox}} theme for the description box; defaults to 15
  • theme2: optional, specifies the {{Robox}} theme for the book box; defaults to 3
  • icon: optional, specifies the logo displayed in the description box without the File: included; defaults to the Wikibooks logo
  • iconwidth: optional, specifies the width of the logo displayed in the description box with px included; defaults to 45px
  • 1: needs to be passed through from the calling subject page to this template, otherwise the subject category can't extra a subject description or full header
  • 2: optional, specifies how much information is allowed to be provided to the subject category; possible values are blank (no description or header), description (only provide a description) or header (provide a full header); note however that header does the same thing as omitting parameter 2, while blank does the same thing as omitting parameter 1

Copy-paste

Commonly-used Full
{{root subject
 |description=
 |1={{{1}}}
}}
{{root subject
 |namespace=
 |theme=
 |theme2=
 |icon=
 |iconwidth=
 |featuredbooks=
 |description=
 |1={{{1}}}
 |2=
}}

Internals

Internals

This template itself only determines which sort of information request is being made, and either provides the information (if it isn't asking for a full subject display); or delegates the request to {{root subject/core}}, which is responsible for generating a full 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 is in Subject: or Template: space, this template always delegates to produce a full display. In all other namespaces, ordinarily the template returns a string describing the parentage of the subject. The general form of the parentage string is described at {{subject page}}; here the string provided is fixed, there being no actual parent parameters by which to vary it, as /Books by subject/ — thus presenting each root subject as a child of single parent Subject:Books by subject. (Subject:Books by subject also uses this same parentage-string scheme, presenting itself as having no parents, i.e., //.)

Parameters 1 and 2 function as described at {{subject page}}.