Jump to content

మూస: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 <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.

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:

Index text

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

Other pages 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.

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:

Other pages 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|}}}
}}