Template:Page index other
This template uses Lua: |
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 <noinclude></noinclude>
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
[edit]This template usually takes three parameters, like this:
{{page index other | Page text | Index text | Other pages text }}
If the template is in the page space ("Page:"), it will return this:
- Page text
If the template is in the index space ("Index:"), it will return this:
- Page text
If the template is on any other page, it will return this:
- Index text
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:
{{page index other | {{x-larger|CONTENTS.}} | {{x-larger|CONTENTS.}} }}
Note that in the case above the "other" parameter was not used.
Demospace
[edit]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:
{{page index other | Page text | Index text | Other pages text | demospace = main }}
No matter on what kind of page the code above is used it will return this:
- Index text
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:
{{page index other | Page text | Index text | Other pages text | demospace = {{{demospace|}}} }}
See also
[edit]- {{Main other}}: for content that varies betwen mainspace and all other namespaces
- {{Page other}}: for content that varies between the Page: 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