This site is supported by donations to The OEIS Foundation.

Template:Test/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:Test. [<Edit> Template:Test]

[⧼Purge⧽ Template:Test/doc]

The {{test}} template testing template is for testing generic properties and/or behaviors of templates.

Testing the {{documentation subpage}} template

The {{documentation subpage}} is transcluded at the top of {{Test/doc}}, giving (with Test/doc instead of expected Test)

   This is the documentation for the {{Test/doc}} template. 

   This documentation subpage contains instructions, categories, or other information for technical reasons.
   To view the Template page itself, see Template:Test/doc.

Cf. Help talk:Documenting templates.

The code of {{documentation subpage}} is


:''This is the documentation for the {{tlxb|{{BASEPAGENAME}}}} template.''
<div class="messagebox" style="text-align:center">
This [[Template:documentation|documentation]] [[wikipedia:Subpages|subpage]] contains instructions, categories, or other information for [[wikipedia:Project:Transclusion costs and benefits|technical reasons]].<br />
<small>To view the {{SUBJECTSPACE}} page itself, see [[{{SUBJECTSPACE}}:{{BASEPAGENAME}}]].</small></div>
<br /><br />[[Category:Template documentation templates|{{BASEPAGENAME}}]]

It doesn't work properly because

{{BASEPAGENAME}} gives Test instead of Test
{{SUBPAGENAME}} gives doc instead of /doc

Here is a table of some expected values for some Magic Words (Cf. mediawikiwiki:Help:Magic words#Page names)

Page names
Variable Output Description Versions
{{FULLPAGENAME}} Template:Test/doc Namespace and page title. 1.6+
{{PAGENAME}} Test/doc Page title.
{{BASEPAGENAME}} Test Page title excluding the current subpage and namespace ("Title/foo" on "Title/foo/bar").

For more complex splitting, use {{#titleparts:}} from ParserFunctions extension.

1.7+
{{SUBPAGENAME}} doc The subpage title ("foo" on "Title/foo"). 1.6+
{{SUBJECTPAGENAME}} Template:Test/doc The namespace and title of the associated subject page. 1.7+
{{TALKPAGENAME}} Template talk:Test/doc The namespace and title of the associated talk page. 1.7+

The {{BASEPAGENAME}} and {{SUBPAGENAME}} magic words only work in namespaces that have subpages enabled. See Manual:$wgNamespacesWithSubpagesMediaWiki.org. for information on enabling subpages.

Daniel Forgues 02:31, 15 August 2011 (UTC)




Pagename
Test/doc
Basepagename
Test
Subpagename
doc

I've copied Help talk:Documenting templates/test as is for a quick and dirty test where I know what it is. –Frank Ellermann 14:00, 15 August 2011 (UTC)


I left a note on User talk:N. J. A. Sloane. — Daniel Forgues 01:18, 16 August 2011 (UTC)


Workaround for BASEPAGENAME

For convenience, I created the templates

{{Basepage name}} (not Basepagename, to make sure the template call is deliberate, to avoid unexpected results throughout the wiki)

and

{{Subpage name}} (not Subpagename, to make sure the template call is deliberate, to avoid unexpected results throughout the wiki)

where

{{Basepage name}}

gives the second to last title part (i.e. the parent part) of {{PAGENAME}}, e.g.

Test

and

{{Subpage name}}

gives the last title part (i.e. the current part) of {{PAGENAME}}, e.g.

doc

Daniel Forgues 04:15, 18 August 2011 (UTC)