Jump to content

Template:Page other/doc

From Wikisource

This is the Wikisource {{Page other}} template.

This template helps other templates detect if they are being displayed on a proofreading page ("Page:" space) or some "other" place (such as the main space).

It effectively mirrors the functionality of <noinclude></noinclude> on a proofread page, by allowing templates to display something only on the proofread page, but not allowing this to be transcluded.

Usage

[edit]

This template usually takes two parameters, like this:

{{page other | Page text | Other pages text }}

If the template is on a proofread page (i.e. in the "Page:" space), it will return this:

Page text

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

Other pages text

A typical usage case could be to make it so that a template only displays footnotes only when on an proofread page. When transcluded into the mainspace, footnotes are added after the transcluded text so they all display at the end rather than page by page. Normally this is done by using <noinclude></noinclude> tags, but in some cases you may want to display footnotes through a template. Like this:

  • Example footnote ("Footnote text")[1]
{{page other | {{reflist}} }}

If the template is on a proofread page (i.e. in the "Page:" space), it will return this:

  1. "Footnote text"

Note that in the case above the "other" parameter was not used. To display something only when not on a proofread page, the "page" parameter can be left empty.

Demospace

[edit]

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

  • If it has the value page it returns the article 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:

{{page other 
| Page text 
| Other pages text 
| demospace = main
}}

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

Other pages text

You can make it so your 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:

{{page other 
| Page text 
| Other pages text 
| demospace = {{{demospace|}}}
}}


See also

[edit]
  • {{Main other}}: for content that varies between mainspace and all other namespaces
  • {{Page index other}}: for content that varies between the Page: namespace, Index: namespace, and all other namespaces
  • {{Namespace detect}}: general purpose template for any content that varies between namespaces
  • {{Namespace link}}: for links that vary between namespaces
  • {{Double link}}: for links in the Page: namespace that vary when in the Page: or mainspace
  • {{Scan page link}}: for auto-offset page links in the Page: namespace, that vary when in Page: Index: or mainspace
  • {{TOC link}}: for table of contents page links in the Page: namesapce, that vary when in Page: Index: or mainspace