Deprecated: Return type of MediaWiki\Session\PHPSessionHandler::open($save_path, $session_name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/PHPSessionHandler.php on line 172

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/web/public_html/wiki/includes/json/FormatJson.php on line 297

Deprecated: Return type of ResultWrapper::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/db/DatabaseUtility.php on line 174

Deprecated: Return type of ResultWrapper::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/db/DatabaseUtility.php on line 192

Deprecated: Return type of ResultWrapper::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/db/DatabaseUtility.php on line 185

Deprecated: Return type of ResultWrapper::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/db/DatabaseUtility.php on line 202

Deprecated: Return type of ResultWrapper::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/db/DatabaseUtility.php on line 163

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: Return type of MediaWiki\Session\Session::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 555

Deprecated: Return type of MediaWiki\Session\Session::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 560

Deprecated: Return type of MediaWiki\Session\Session::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 570

Deprecated: Return type of MediaWiki\Session\Session::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 565

Deprecated: Return type of MediaWiki\Session\Session::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 580

Deprecated: Return type of MediaWiki\Session\Session::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 575

Deprecated: Return type of MediaWiki\Session\Session::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 589

Deprecated: Return type of & MediaWiki\Session\Session::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 601

Deprecated: Return type of MediaWiki\Session\Session::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 610

Deprecated: Return type of MediaWiki\Session\Session::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/web/public_html/wiki/includes/session/Session.php on line 614

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: Message implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /home/web/public_html/wiki/includes/Message.php on line 159

Deprecated: RawMessage implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /home/web/public_html/wiki/includes/Message.php on line 1232

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Warning: Cannot modify header information - headers already sent by (output started at /home/web/public_html/wiki/includes/session/Session.php:48) in /home/web/public_html/wiki/includes/Feed.php on line 234

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/web/public_html/wiki/includes/session/Session.php:48) in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/web/public_html/wiki/includes/session/Session.php:48) in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/web/public_html/wiki/includes/session/Session.php:48) in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /home/web/public_html/wiki/includes/WebResponse.php on line 42

Warning: Cannot modify header information - headers already sent by (output started at /home/web/public_html/wiki/includes/session/Session.php:48) in /home/web/public_html/wiki/includes/WebResponse.php on line 42
http://redwolf.ws/wiki/index.php?title=Help:Template_documentation&feed=atom&action=history Help:Template documentation - Revision history 2024-05-03T03:06:48Z Revision history for this page on the wiki MediaWiki 1.27.0
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/web/public_html/wiki/includes/db/Database.php on line 1742
http://redwolf.ws/wiki/index.php?title=Help:Template_documentation&diff=14&oldid=prev STrRedWolf: 1 revision(s) 2007-11-11T17:55:40Z <p>1 revision(s)</p> <p><b>New page</b></p><div>{{h:h}}[[Category:Editor handbook]]<br /> There are several ways to document what a template is supposed to do:<br /> # In some cases it is obvious on the template page itself without special provisions.<br /> # It can be explained in &lt;code&gt;&amp;lt;noinclude&amp;gt;&lt;/code&gt;&#039;&#039;text&#039;&#039;&lt;code&gt;&amp;lt;/noinclude&amp;gt;&lt;/code&gt; tags.<br /> #:This method allows for such things as adding the template to a template [[Help:category|category]].<br /> # Detailed documentation can be put on the &#039;&#039;&#039;template talk&#039;&#039;&#039; page.<br /> #:This method is typically mixed with the noinclude-strategy on the template page, with a reference to the talk page, and perhaps a summary.<br /> <br /> ==Pre-expand include size==<br /> Transcluding a template directly or indirectly on a page adds to the {{peis}} of that page. In general, documentation of the template (including categorization) on the template page adds to this pre-expand include size by an amount per call of 23 bytes for the noinclude tags, plus the size of the unexpanded wikitext for the documentation. In view of the {{peisl}} it is useful to minimize this size by transcluding a documentation page instead of putting the info directly. This can conveniently be done with a template like {{tim|Documentation}}. When using the shortcut of the latter we need only 7 bytes for the wikitext &quot;&lt;nowiki&gt;{{doc}}&lt;/nowiki&gt;&quot;, so typically much less than the documentation text itself. Together the documentation and categorization of the template adds 30 bytes per direct or indirect transclusion.<br /> <br /> What follows needs modification in this regard.<br /> <br /> == On the template page ==<br /> The [[Help:template|template]] page serves two purposes: defining the way it works when included in another page, and producing a rendered page providing information. The parts not in &lt;tt&gt;noinclude&lt;/tt&gt; tags define the template for the system. The parts of the wikitext not in &lt;tt&gt;includeonly&lt;/tt&gt; tags are rendered on the template page. With the two types of tag pairs the template page can be used for both definition &#039;&#039;and&#039;&#039; documentation.<br /> <br /> A typical template page could contain:<br /> <br /> &lt;nowiki&gt;&lt;includeonly&gt;&lt;/nowiki&gt;&lt;nowiki&gt;&lt;!--&lt;/nowiki&gt;&#039;&#039;template name&#039;&#039;&lt;nowiki&gt;--&gt;&lt;/nowiki&gt;&#039;&#039;definition content, possibly a tag for a category of pages that include the template&#039;&#039;&lt;nowiki&gt;&lt;/includeonly&gt;&lt;noinclude&gt;&lt;&lt;/nowiki&gt;nowiki&gt;&#039;&#039;definition content, possibly formatted, annotated, summarized&#039;&#039;&lt;nowiki&gt;&lt;&lt;/nowiki&gt;/nowiki&gt;&#039;&#039;further explanation, tags for template categories (using the sortkey &lt;nowiki&gt;{{PAGENAME}}&lt;/nowiki&gt;)&#039;&#039;&lt;nowiki&gt;&lt;/noinclude&gt;&lt;/nowiki&gt;<br /> <br /> The template name within comment tags is useful in the case of substitution.<br /> <br /> For example, for {{tim|t}}:<br /> <br /> &lt;nowiki&gt;&lt;includeonly&gt;start-{{{1|pqr}}}-end&lt;/includeonly&gt;&lt;noinclude&gt;&lt;&lt;/nowiki&gt;nowiki&gt;start-&lt;nowiki&gt;{{{1|pqr}}}-end&lt;&lt;/nowiki&gt;/nowiki&gt;[[Category:Demo template]]&lt;nowiki&gt;[[Category:Demo template]]&lt;/noinclude&gt;&lt;/nowiki&gt;<br /> <br /> This renders as:<br /> <br /> :&lt;includeonly&gt;start-{{{1|pqr}}}-end&lt;/includeonly&gt;&lt;noinclude&gt;&lt;nowiki&gt;start-{{{1|pqr}}}-end&lt;/nowiki&gt;&lt;/noinclude&gt;<br /> <br /> while without tags part of the information about the content would not be displayed:<br /> <br /> :start-{{{1|pqr}}}-end<br /> <br /> Alternatively the part of the definition content which is rendered without loss of information (in particular plain text) is not put in either type of tags, so that it does not have to be duplicated:<br /> <br /> start-&lt;nowiki&gt;&lt;includeonly&gt;{{{1|pqr}}}&lt;/includeonly&gt;&lt;noinclude&gt;&lt;&lt;/nowiki&gt;nowiki&gt;&lt;nowiki&gt;{{{1|pqr}}}&lt;&lt;/nowiki&gt;/nowiki&gt;&lt;nowiki&gt;[[Category:Demo template]]&lt;/noinclude&gt;&lt;/nowiki&gt;-end<br /> <br /> again rendered as:<br /> <br /> :start-&lt;includeonly&gt;{{{1|pqr}}}&lt;/includeonly&gt;&lt;noinclude&gt;&lt;nowiki&gt;{{{1|pqr}}}&lt;/nowiki&gt;&lt;/noinclude&gt;-end<br /> <br /> Applying substitution without parameter produces this as wikitext. It can be displayed by subsequently putting nowiki tags around it.<br /> <br /> ===Table===<br /> If a template produces a table it is useful if the template page shows the table structure instead of the wikitext to make it. For that purpose the table syntax is not put in either type of tags, and the table elements, where needed, each have a noinclude and an includeonly part.<br /> <br /> ===Rendering===<br /> As shown above, in straightforward rendering of definition content, information is &#039;&#039;lost&#039;&#039; in the case of a parameter with a default value: only that value is rendered. Other cases where information is lost include:<br /> *&lt;nowiki&gt;#&lt;/nowiki&gt;expr applied to an expression with a parameter gives &quot;Expression error: unrecognised punctuation character &quot;{&quot;&quot;.<br /> *a variable is rendered as its value.<br /> <br /> The [[Help:parameter default|parameter default]] mechanism can also be used to document what a parameter typically does:<br /> *An undefined &lt;nowiki&gt;{{{1}}}&lt;/nowiki&gt; is rendered as &lt;nowiki&gt;{{{1}}}&lt;/nowiki&gt;, clearly indicating that the template expects to get a first parameter.<br /> *An undefined &lt;nowiki&gt;{{{1|}}}&lt;/nowiki&gt; displays nothing, that&#039;s probably the desired effect, but not helpful for a self-documentating template.<br /> *Maybe it&#039;s possible to indicate the function of an expected parameter, e.g. &lt;nowiki&gt;{{{1|image}}}&lt;/nowiki&gt; for templates doing something with images.<br /> <br /> Typically, examples in the noinclude-part include or [[Help:substitution|substitute]] the template. Note that changes in the working of the template (i.e. changes outside the noinclude-part) are not yet effective in these examples in [[Help:Show preview|preview]] and, in the case of substitution, in &quot;show changes&quot;.<br /> <br /> ===Category===<br /> Some templates are designed to add pages to a given category. Sometimes it&#039;s good enough if the template page itself is also shown in that category.<br /> Generally that&#039;s not the case. Templates adding pages to a category then use:<br /> &#039;&#039;...end of code&#039;&#039;&amp;lt;includeonly&amp;gt;[&amp;#91;Category:&#039;&#039;target&#039;&#039;&amp;#93;]<br /> &amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;<br /> &#039;&#039;documentation and/or link to talk page&#039;&#039;<br /> [&amp;#91;Category:&#039;&#039;tempcat&#039;&#039;|{&amp;#123;PAGENAME&amp;#125;}&amp;#93;]<br /> &amp;lt;/noinclude&amp;gt;<br /> Here &#039;&#039;target&#039;&#039; means a category for pages using the template, and<br /> &#039;&#039;tempcat&#039;&#039; is a category for similar templates.<br /> This method could be also used for interlanguage links in a template.<br /> <br /> A small improvement seen on some templates replaces<br /> &lt;tt&gt;[&amp;#91;Category:&#039;&#039;target&#039;&#039;&amp;#93;]&lt;/tt&gt; by<br /> &lt;tt&gt;&lt;nowiki&gt;{{{category|[[Category:&lt;/nowiki&gt;&#039;&#039;target&#039;&#039;&lt;nowiki&gt;]]}}}&lt;/nowiki&gt;&lt;/tt&gt;.<br /> Normally the dummy parameter &lt;tt&gt;&lt;nowiki&gt;{{{category}}}&lt;/nowiki&gt;&lt;/tt&gt; is undefined (unused),<br /> and then the template adds pages to category &#039;&#039;target&#039;&#039; as before. Setting &lt;tt&gt;category=&lt;/tt&gt;<br /> (empty value) allows to disable this feature on lists of templates. Otherwise template lists<br /> with examples would be added to the various &#039;&#039;target&#039;&#039; categories of templates explained by example.<br /> <br /> ==Template talk page==<br /> <br /> In addition, the template &#039;&#039;talk&#039;&#039; page can be used to explain the template and its parameters. Preferably examples are given of template calls (put them in nowiki tags) and the results (put the template call without nowiki tags in the wikitext). In complicated cases, [[Help:substitution|substitution]] can be very helpful in the explanation to demonstrate the working.<br /> <br /> The talk page of course still offers to discuss the template after its documentation.<br /> <br /> ==Templates for documentation==<br /> A template can help producing &quot;.. gives ..&quot; without duplicating code. For example, using {{tim|evd}}, <br /> &lt;nowiki&gt;{{evd|t2|a|b}}&lt;/nowiki&gt; gives:<br /> <br /> {{evd|t2|a|b}}<br /> <br /> However, the possibilities for passing wikitext code as parameter value are limited: a parameter value without nowiki tags cannot be used as unexpanded string, while one with nowiki tags cannot be expanded. See also [[mw:Extension:ExpandAfter#Example: nowiki]].<br /> <br /> == See also ==<br /> * [[w:Wikipedia:Template doc page pattern]]<br /> * {{tim|doctl}}<br /> * {{tiw|en|doctl}}<br /> <br /> {{h:f|enname=Template documentation}}</div> STrRedWolf