This site is supported by donations to The OEIS Foundation.

Help:Documenting templates

From OeisWiki
Jump to navigationJump to search

It's not yet sure that OeisWiki templates need the same documentation style used on other MediaWiki projects, but copied templates might expect this feature.

Using a /doc subpage

[edit]

If you need a separate documentation (recommended unless very short) page for the template, a standard way is to use a /doc subpage for the template, e.g.

Template:factorial with documentation page Template:factorial/doc

Use {{documentation}} in the <noinclude> ... </noinclude> section of your template and your /doc subpage will be automatically transcluded. If your documentation is very short you may also just have it directly in the <noinclude> ... </noinclude> section of your template.

In your /doc subpage use something like the following to link back to your template


<noinclude>:''This is the documentation of the {{tlxb|factorial}} mathematical function template.''<br /><br />
[[Category:Template documentation templates|{{PAGENAME}}]]</noinclude>

where the {{tlxb|factorial}} template creates a Template Link eXpanded (monospace font) in Bold with its template name parameter, e.g. {{factorial}} in this case.

Please note that for some reason, the {{documentation subpage}} template is not working yet. It should automatically add the following


<noinclude>:''This is the documentation of the {{tlxb|factorial}} template.''<br /><br />
[[Category:Template documentation templates|{{PAGENAME}}]]</noinclude>

The {{documentation subpage}} template is now working! (using a workaround, see {{test/doc}}) — Daniel Forgues 02:26, 18 August 2011 (UTC)

Using a /test subpage

[edit]

If you need a separate test page for the template, a standard way is to use a /test subpage for the template, e.g.

Template:factorial with test page Template:factorial/test

Using a /code subpage

[edit]

If you need a separate source code page for the template, a standard way is to use a /code subpage for the template, e.g.

Template:factorial with test page Template:factorial/code

Just put the source code between <pre style="overflow: auto;"> ... </pre> tags, e.g.


Source code for the template (wikitext, parser functions, HTML, ...)