Template:Page index other/doc

This is the Wikisource Page index other template.

This template helps other transcluded pages detect if they are being displayed on a proofreading page ("Page:" space), an index ("Index:" space) or some "other" place (such as transcluded into the main space).

It extends the functionality of by distinguishing the index space as well as just the page space and others.

It is primarily designed to allow TOCs from multi-volume works to be displayed in one way on the page (i.e. the complete text), another in the index (the complete TOC page for that volume, including headings) and a third way when transcluded into the mainspace (no headings, to allow continuation from previous volumes' TOCs). See Page:Tales by Musæus, Tieck, Richter, Volume 2.djvu/7, Index:Tales by Musæus, Tieck, Richter, Volume 2.djvu and Tales by Musæus, Tieck, Richter for a working example.

Usage
This template usually takes three parameters, like this:

If the template is in the page space ("Page:"), it will return this:



If the template is in the index space ("Index:"), it will return this:



If the template is on any other page, it will return this:



A typical usage case could be to transclude a table of contents on an index page, but hide the headings when transcluded into the mainspace, to allow it to continue seamlessly from a previous volume's TOC (e.g. Page:Tales by Musæus, Tieck, Richter, Volume 2.djvu/7, index and mainspace). Like this:

Note that in the case above the "other" parameter was not used.

Demospace
For testing and demonstration purposes this template can take a parameter named demospace.


 * If it has the value page it returns the page space text.
 * If it has the value index it returns the index space text.
 * If it has the value other or any other value such as the name of some other namespace it returns the other pages text.
 * If the parameter is empty or undefined, the actual page type determines the result.

Like this:

No matter on what kind of page the code above is used it will return this:



If used in a template, you can make it so the template also understands the demospace parameter. That means you can demonstrate the different appearances of your template in the documentation for your template. Then do like this: