Jump to content

Template:Magic word templates/subject page examples/doc

From Wikibooks, open books for an open world

Transclude this on the documentation page of a magic word template relating a page to its associated subject, to produce a table of examples of the template's behavior on various page names. The template is expected to accept an unnamed parameter overriding the current page name. See for example Template:SUBJECTNAME/doc.

This template itself accepts an unnamed parameter specifying the name of the template to be demonstrated; otherwise it uses {{OBJECTPAGENAME}}. For example,

{{Template:Magic word templates/subject page examples|SUBJECTNAME}}

would produce

page where called result note
Subject:Biology Subject:Biology
Biology Subject:Biology likely the Subject: prefix was simply omitted
Wikijunior:Subject:Biology Subject:Biology the Subject: prefix in the pagename overrides all other considerations
Wikijunior:Biology Subject:Wikijunior:Biology parallel to content-space behavior of {{BOOKNAME}}
Template:Biology Subject:Biology ignore namespace prefix of non-content namespace
Category:Subject:Biology/all books Subject:Biology the Subject: prefix in the pagename overrides all other considerations
Category:Biology/all books Subject:Biology ignore namespace prefix of non-content namespace

Internals

[edit source]

The examples are in subtemplate {{Magic word templates/subject page examples/core}}; this template only chooses the target for demonstration and delegates there.