Template:Quote

From MyFallen Gaming Community
Revision as of 10:26, 14 January 2020 by NoMansLand (talk | contribs) (Created page with "<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200"><noinclude>Template:Lorem ipsum</noinclude><includeonly>Script error: No such module "Error".</includeonly></div><div class="templatequotecite">&#8212;<noinclude>Someone</noinclude>,&nbsp;<cite><noinclude>Source</noinclude></cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: both;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Contents

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">{{{1}}}</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">[[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>{{{1}}}</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">This box: </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- -->[[Template:{{{1}}}|<span style="" title="View this template"><!-- -->view</span>]]<!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[[Template talk:{{{1}}}|<span style="" title="Discuss this template"><!-- -->talk</span>]]<!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[{{fullurl:Template:{{{1}}}|action=edit}} <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki><mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200">phrase</div><div class="templatequotecite">&#8212;person,&nbsp;<cite>source</cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: phrase;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">phrase</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">person<span style="display:none"> </span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>phrase</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- -->Template:Markup/row<!-- -->Template:Markup/row<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">This box: </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- --><span style="" title="View this template"><!-- -->view</span><!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- --><span style="" title="Discuss this template"><!-- -->talk</span><!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[http://wiki.myfallen.net/index.php?title=Template:Phrase&action=edit <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Named parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Example

Wikitext

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Result

Template loop detected: Template:Quote

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap"></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

phrase </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{phrase&#124;person&#124;source}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">String Module Error: String subset index out of range<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;"></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki></nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki><mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200">phrase</div><div class="templatequotecite">&#8212;person,&nbsp;<cite>source</cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: phrase;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">phrase</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">person<span style="display:none"> </span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>phrase</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- -->Template:Markup/row<!-- -->Template:Markup/row<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">This box: </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- --><span style="" title="View this template"><!-- -->view</span><!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- --><span style="" title="Discuss this template"><!-- -->talk</span><!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[http://wiki.myfallen.net/index.php?title=Template:Phrase&action=edit <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Named parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Example

Wikitext

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Result

Template loop detected: Template:Quote

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap"></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

phrase </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{phrase&#124;person&#124;source}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">String Module Error: String subset index out of range<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;"></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki></nowiki></code>

Named parameters

<code><nowiki><mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200">phrase</div><div class="templatequotecite">&#8212;person,&nbsp;<cite>source</cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: both;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">{{{1}}}</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">[[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>{{{1}}}</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">phrase </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- -->[[Template:{{{1}}}|<span style="" title="View this template"><!-- -->view</span>]]<!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[[Template talk:{{{1}}}|<span style="" title="Discuss this template"><!-- -->talk</span>]]<!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[{{fullurl:Template:{{{1}}}|action=edit}} <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Named parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Example

Wikitext

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Result

Template loop detected: Template:Quote

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap">&lt;tag&gt;...&lt;&#47;tag&gt;</code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

Quote </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{Tlx}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">Template:<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;">&lt;tag&gt;<!--nothing--></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki></nowiki></code>

Example

Wikitext

<code><nowiki><mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200">Cry "Havoc" and let slip the dogs of war.</div><div class="templatequotecite">&#8212;William Shakespeare,&nbsp;<cite>Julius Caesar, act III, scene I</cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: both;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">{{{1}}}</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">[[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>{{{1}}}</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">Cry "Havoc" and let slip the dogs of war. </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- -->[[Template:{{{1}}}|<span style="" title="View this template"><!-- -->view</span>]]<!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[[Template talk:{{{1}}}|<span style="" title="Discuss this template"><!-- -->talk</span>]]<!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[{{fullurl:Template:{{{1}}}|action=edit}} <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Named parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Example

Wikitext

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Result

Template loop detected: Template:Quote

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap">&lt;tag&gt;...&lt;&#47;tag&gt;</code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

Quote </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{Tlx}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">Template:<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;">&lt;tag&gt;<!--nothing--></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki></nowiki></code>

Result

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">

 <siteinfo>
   <sitename>MediaWiki</sitename>
   <dbname>mediawikiwiki</dbname>
   <base>https://www.mediawiki.org/wiki/MediaWiki</base>
   <generator>MediaWiki 1.35.0-wmf.14</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Project</namespace>
     <namespace key="5" case="first-letter">Project talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="90" case="first-letter">Thread</namespace>
     <namespace key="91" case="first-letter">Thread talk</namespace>
     <namespace key="92" case="first-letter">Summary</namespace>
     <namespace key="93" case="first-letter">Summary talk</namespace>
     <namespace key="100" case="first-letter">Manual</namespace>
     <namespace key="101" case="first-letter">Manual talk</namespace>
     <namespace key="102" case="first-letter">Extension</namespace>
     <namespace key="103" case="first-letter">Extension talk</namespace>
     <namespace key="104" case="first-letter">API</namespace>
     <namespace key="105" case="first-letter">API talk</namespace>
     <namespace key="106" case="first-letter">Skin</namespace>
     <namespace key="107" case="first-letter">Skin talk</namespace>
     <namespace key="486" case="first-letter">Data</namespace>
     <namespace key="487" case="first-letter">Data talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="1198" case="first-letter">Translations</namespace>
     <namespace key="1199" case="first-letter">Translations talk</namespace>
     <namespace key="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
     <namespace key="5500" case="first-letter">Newsletter</namespace>
     <namespace key="5501" case="first-letter">Newsletter talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Quote</title>
   <ns>10</ns>
   <id>156408</id>
   <revision>
     <id>1958722</id>
     <parentid>1958716</parentid>
     <timestamp>2015-12-07T14:45:10Z</timestamp>
     <contributor>
       <username>Matiia</username>
       <id>1724051</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 73.36.172.167 (talk) to last revision by Shirayuki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="718" xml:space="preserve"><blockquote class="templatequote"><div class="Bug6200">Cry "Havoc" and let slip the dogs of war.</div><div class="templatequotecite">&#8212;William Shakespeare,&nbsp;<cite>Julius Caesar, act III, scene I</cite></div></blockquote><noinclude>
50px Template documentation[create]

<!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>eer6uc0kgameb2yju46xdlh56mt1zpx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Blockquote paragraphs</title>
   <ns>10</ns>
   <id>156414</id>
   <revision>
     <id>791353</id>
     <parentid>791352</parentid>
     <timestamp>2013-09-27T12:31:43Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>40 revisions from w:en:Template:Blockquote paragraphs</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="645" xml:space="preserve"><div style="float: right; padding: 0 1em;">Template:Navbar</div>

The Template:Tag element and any templates that use it do not honor newlines: Template:Markup

To resolve this, use the Template:Xtag tag inside Template:Tag: Template:Markup<noinclude>

50px Template documentation[create]

<!-- Categories go on the /doc subpage. -->

</noinclude></text>

     <sha1>25h04gqc23j3a6q2fe8moikg7ckc0mx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>36793</id>
   <revision>
     <id>3313327</id>
     <parentid>3312250</parentid>
     <timestamp>2019-07-12T22:36:32Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:Clear: Page about technical change that was posted to a local wiki</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="81" xml:space="preserve"><div style="clear: both;"></div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9nf5jpu20gfz4qi6z5x9fip45krv0ef</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>20803</id>
   <revision>
     <id>3564582</id>
     <parentid>3564556</parentid>
     <timestamp>2019-12-11T21:55:30Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>dummy edit to update translation pages</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1730" xml:space="preserve"><noinclude>

<languages/> </noinclude><includeonly>Script error: No such module "Template translation".</includeonly><noinclude>

50px Template documentation

<translate> ==Usage== <!--T:2-->

===Customizing display=== <!--T:3-->

<!--T:4--> Overrides exist to customize the output in special cases: </translate>

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - <translate><!--T:5--> change the text of the "documentation" heading.</translate> <translate><!--T:10--> If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.</translate>

<translate> ==Rationale== <!--T:6-->

<!--T:7--> This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.</translate> <translate> <!--T:8--> It also reduces server resources by circumventing a technical limitation of templates (see a [<tvar

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>ndvar9cdedjmgkmw33zbdjwn1xz5wdb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/en</title>
   <ns>10</ns>
   <id>952042</id>
   <revision>
     <id>3564592</id>
     <parentid>3521749</parentid>
     <timestamp>2019-12-11T22:00:15Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1474" xml:space="preserve"><noinclude>

<languages/>

</noinclude><includeonly>

50px Template documentation[create]

</includeonly><noinclude>

50px Template documentation

Usage

Customizing display

Overrides exist to customize the output in special cases:

  • <nowiki>{{</nowiki>documentation|heading=<nowiki>}}</nowiki> - change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Rationale

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links. It also reduces server resources by circumventing a technical limitation of templates (see a developer's explanation).

See also

[[Category:Formatting templates{{#translation:}}|Template documentation]] [[Category:Template documentation{{#translation:}}| ]] </noinclude><includeonly></includeonly></text>

     <sha1>j75iwo8eqp7j260mprfi43iiwgigd1g</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>20806</id>
   <revision>
     <id>3259030</id>
     <parentid>3259002</parentid>
     <timestamp>2019-06-03T11:52:45Z</timestamp>
     <contributor>
       <username>Tomybrz</username>
       <id>11593352</id>
     </contributor>
     <minor/>
     <comment>All page buged...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1679" xml:space="preserve"><includeonly><!--
--><!--(this template has not been transcluded on a /doc or /{{{override}}} page)--><!--

--></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>lp11m105g1fm3wsief3nup5b709pt28</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For</title>
   <ns>10</ns>
   <id>156415</id>
   <revision>
     <id>3215031</id>
     <parentid>3215027</parentid>
     <timestamp>2019-04-30T07:46:12Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>translation tweaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="682" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>roa6tew7eo9gidohbvgwew6beqhnyr2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:For/en</title>
   <ns>10</ns>
   <id>920996</id>
   <revision>
     <id>3215033</id>
     <parentid>3215029</parentid>
     <timestamp>2019-04-30T07:46:29Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="614" xml:space="preserve"><noinclude>

<languages /> </noinclude>Template:Hatnote<noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>gy9wh8aok5pe350q136lvdgauq9s3em</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>156416</id>
   <revision>
     <id>2039178</id>
     <parentid>791490</parentid>
     <timestamp>2016-02-04T08:22:29Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>337803</id>
     </contributor>
     <comment>role="note"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="88" xml:space="preserve"><div role="note" class="dablink">{{{1}}}</div><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>9xgdxxj7nma5nnrwr0ml0qeq1xyocn7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Ll</title>
   <ns>10</ns>
   <id>119010</id>
   <redirect title="Template:Localized link" />
   <revision>
     <id>3388614</id>
     <parentid>665179</parentid>
     <timestamp>2019-08-30T05:43:05Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Ll": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="37" xml:space="preserve">#REDIRECT Template:Localized link</text>
     <sha1>qmnhyglpbw33o7ge1i1x624h663kt7h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Localized link</title>
   <ns>10</ns>
   <id>119007</id>
   <revision>
     <id>3445149</id>
     <parentid>3306148</parentid>
     <timestamp>2019-10-05T17:12:29Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Localized link": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1028" xml:space="preserve">[[Special:MyLanguage/{{{1}}}|{{{1}}}]]<span style="display:none">[[:{{{1}}}| ]]</span><!-- T63547 --><noinclude>

{{ Template:TNTN }} </noinclude></text>

     <sha1>84uk5tzlz7mvvdac3chb2ijsqf9wr60</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem Ipsum</title>
   <ns>10</ns>
   <id>56150</id>
   <revision>
     <id>1520870</id>
     <parentid>1520821</parentid>
     <timestamp>2015-04-08T11:25:45Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by 93.140.228.34 (talk) to last revision by Wargo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="489" xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<noinclude> </noinclude></text>

     <sha1>cc52fupaasth9kko3zmbvxbx2l20002</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lorem ipsum</title>
   <ns>10</ns>
   <id>56149</id>
   <revision>
     <id>1411200</id>
     <parentid>1411199</parentid>
     <timestamp>2015-02-16T02:30:39Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <minor/>
     <comment>Krinkle moved page Template:Lorem to Template:Lorem ipsum</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>

<text bytes="822" xml:space="preserve"><includeonly>Template:Lorem Ipsum

</includeonly><noinclude>

Template:Lorem Ipsum

Purpose
Provide a quick "boilerplate" filler text used solely as a template debugging aid, to examine wrapping, nesting, and margins or padding in template design and testing.
Usage
This template merely displays the latin paragraph shown above, but does so up to four times defined by <nowiki>{{{1}}}</nowiki> and displays (calls) Template:Lorem Ipsum N=(1-4) times with appropriate line breaks.
related

</noinclude></text>

     <sha1>pjopojki6p3dcmove7k9hro85o6hvpd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup</title>
   <ns>10</ns>
   <id>156418</id>
   <revision>
     <id>791571</id>
     <parentid>791570</parentid>
     <timestamp>2013-09-27T12:32:17Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>34 revisions from w:en:Template:Markup</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="2133" xml:space="preserve"><includeonly>{| style="table-layout: fixed; width: 100%; border-width: medium; margin-left: 0em;"

! style="width:50%" scope="col" | Markup ! style="width:50%" scope="col" | Renders as<!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" |

|}</includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>4adyeuoxit659aw3lf4bh1oqyllc0cw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Markup/row</title>
   <ns>10</ns>
   <id>156419</id>
   <revision>
     <id>791591</id>
     <parentid>791590</parentid>
     <timestamp>2013-09-27T12:32:19Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>19 revisions from w:en:Template:Markup/row</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="930" xml:space="preserve"><noinclude>{| style="width:90%; border-width: medium;"</noinclude><br />

|-

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid none none solid; border-color: #ddd; vertical-align:text-top;" |

Markup

| style="width:50%; background-color: #f9f9f9; border-width: 1px; padding: 5px; border-style: solid solid none solid; border-color: #ddd; vertical-align:text-top;" | Renders <noinclude> |- | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | | style="width:50%; border-width: 1px; padding: 5px; border-style: solid none none none; border-color: #ddd; vertical-align:text-top;" | |}</noinclude></text>

     <sha1>3pro7n7bu5qgyz9rbongpdl9xe7uyi8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>75237</id>
   <revision>
     <id>3596411</id>
     <parentid>3579596</parentid>
     <timestamp>2020-01-06T11:24:10Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4815" xml:space="preserve"><noinclude>

<languages /> </noinclude>Script error: No such module "Template translation".<noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>458hla56ph1juczv0i8xu99m3uzvcg0</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbar/en</title>
   <ns>10</ns>
   <id>843442</id>
   <revision>
     <id>3596467</id>
     <parentid>3452346</parentid>
     <timestamp>2020-01-06T11:25:37Z</timestamp>
     <contributor>
       <username>FuzzyBot</username>
       <id>451990</id>
     </contributor>
     <comment>Updating to match new version of source page</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4451" xml:space="preserve"><noinclude>

<languages /> </noinclude><span class="noprint plainlinks navbar" style=""><small><!--

--><!--else: --><span style="">Cry "Havoc" and let slip the dogs of war. </span><!--

--><!--

--><span style="white-space:nowrap;word-spacing:-.12em;"><!-- -->[[Template:{{{1}}}|<span style="" title="View this template"><!-- -->view</span>]]<!--

--><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[[Template talk:{{{1}}}|<span style="" title="Discuss this template"><!-- -->talk</span>]]<!--

--><!--else: --><span style="">&#32;<b>&middot;</b>&#32;</span><!-- -->[{{fullurl:Template:{{{1}}}|action=edit}} <span style="" title="Edit this template"><!-- -->edit</span>]<!-- --></span><!--

--><!--

--></small></span><noinclude>

50px Template documentation

Usage

General

When one of the following examples is placed inside a given template, it adds navbar navigational functionality:

<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>
<tt><nowiki>Template:Navbar</nowiki></tt>

The <code><nowiki>Quote</nowiki></code> will be substituted with the template's name when parsed by the servers. For example, <code><nowiki>Template:Navbar</nowiki></code> gives:

Template:Navbar

Font-size

Font-size is 88% when used in a navbar, and 100% when nested in a navbox. In the navbar, the weight is "normal"; when nested in navbox, it takes on the outer setting. The middot is bold.

Examples

Required parameters

  • <code><nowiki>Template:Navbar</nowiki></code> – the template name is required.

Optional parameters

<table class="wikitable"> <tr> <th>Options</th><th>Parameters</th><th>Produces...</th> </tr><tr> <td>Basic</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Different text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Without "This box:" text</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>Short version</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With a color option</td><td><code><nowiki>Template:Navbar</nowiki></code></td><td>Template:Navbar</td> </tr><tr> <td>With brackets</td> <td><code><nowiki>Template:Navbar</nowiki></code></td> <td>Template:Navbar</td> </tr> </table>

Deprecated parameters

The <tt>miniv=1</tt>, <tt>viewplain=1</tt>, <tt>nodiv=1</tt> and <tt>fontcolor=</tt> parameters have been deprecated. To implement the view-only version, use the Template:Tlx or Template:Tlx templates instead.

Notes

Navbar is contained within a Template:Tag in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a Template:Tag or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.

Prepackaged

{{Tnavbar-header}}
Positions <small>vTemplate:·dTemplate:·e</small> on the right edge of the line, often used in non-collapsible navbox heading.
{{Tnavbar-navframe}}
For use in conjunction with Navframe divs, positions <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.
{{Tnavbar-collapsible}}
For use in conjunction with Collapsible tables, floats <small>vTemplate:·dTemplate:·e</small> opposite of the [hide]/[show] feature.

<!--- PLEASE ADD METADATA TO THE <includeonly> SECTION HERE ---> <includeonly> [[Category:Formatting templates{{#translation:}}]] </includeonly>

</noinclude></text>

     <sha1>35rfiwnxgiyjfev5k0ses4q9h5nl6hk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pagelang</title>
   <ns>10</ns>
   <id>190171</id>
   <revision>
     <id>3503449</id>
     <parentid>3497222</parentid>
     <timestamp>2019-11-10T01:45:55Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>This template should return empty string if the pagename does not end with "/en" for consistency</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="300" xml:space="preserve">Script error: No such module "Template translation".<noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>mwhgv9bv6r6vtl8ip81ok1lic6e8zje</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quotation templates see also</title>
   <ns>10</ns>
   <id>156422</id>
   <revision>
     <id>791832</id>
     <parentid>791788</parentid>
     <timestamp>2013-09-27T12:33:03Z</timestamp>
     <contributor>
       <username>Dantman</username>
       <id>8614</id>
     </contributor>
     <minor/>
     <comment>44 revisions from w:en:Template:Quotation templates see also</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1384" xml:space="preserve"><DIV STYLE="float:right; padding:0 1em;">Template:Tnavbar</DIV>

Similar templates comparison:

--><noinclude>

Usage

This template can be added in the "See also" section of the main templates of Category: Quotation templates. There are no parameters:

<PRE>

See also

Template:Quotation templates see also </PRE>

The section can provide more information, preferably in the same format with intro, such as:

<PRE>

See also

Direct variants:

Template:Quotation templates see also

Useful related templates:

</PRE>

</noinclude></text>

     <sha1>spe9ypgbw7tixlfqqf9tuy24szg3x70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Quote/doc</title>
   <ns>10</ns>
   <id>156409</id>
   <revision>
     <id>2201198</id>
     <parentid>2069423</parentid>
     <timestamp>2016-07-25T05:44:43Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>54860</id>
     </contributor>
     <comment>+cat.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="4041" xml:space="preserve">

Template:For

Usage

Template:Tlx adds a block quotation to an article page.

This is easier to type and more wiki-like than the equivalent HTML Template:Tag tags, and has additional pre-formatted attribution and source parameters. <!-- THIS WORKAROUND FAILED; see talk page and its archives. New workaround provided hereafter. It also contains a workaround for Bugzilla:6200, which means you don't need to type Template:Tag tags manually. -->

Note: Block quotes do not normally contain quotation marks. See MOS:QUOTE.

Synopsis

Unnamed (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code> This markup will fail if any parameter contains an equals sign (=).

Numbered (positional) parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Named parameters

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Example

Wikitext

<code><nowiki>Template loop detected: Template:Quote</nowiki></code>

Result

Template loop detected: Template:Quote

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap">&lt;tag&gt;...&lt;&#47;tag&gt;</code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

Quote </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{Tlx}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">Template:<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;">&lt;tag&gt;<!--nothing--></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki>

Restrictions

If you do not provide quoted text, the template generates a parser error message, which will appear in red text in the rendered page.

If any parameter's actual value contains an equals sign (=), you must use named parameters. (The equals sign gets interpreted as a named parameter otherwise.)

If any parameter's actual value contains characters used for wiki markup syntax (such as pipe, brackets, single quotation marks, etc.), you may need to escape it. See Template:! and friends.

Be wary of URLs which contain restricted characters. The equals sign is especially common.

Multiple paragraphs

Template:Blockquote paragraphs

TemplateData

Template:TemplateDataHeader <templatedata>{

 "description": "Adds a block quotation.",
 "params": {
   "text": {
     "label": "text",
     "description": "The text to quote",
     "type": "string",
     "required": false,
     "aliases": [ "1", "quote" ]
   },
   "sign": {
     "label": "sign",
     "description": "The person who is being quoted",
     "type": "string",
     "required": false,
     "aliases": [ "2", "cite" ]
   },
   "source": {
     "label": "source",
     "description": "A source for the quote",
     "type": "string",
     "required": false,
     "aliases": [ "3" ]
   }
 }

}</templatedata>

See also

Template:Quotation templates see also

<includeonly> <!-- ADD CATEGORIES AFTER THIS LINE --> ar:قالب:اقتباس as:Template:Quote bg:Шаблон:Цитат ca:Plantilla:Citació cs:Šablona:Citace cy:Nodyn:Dyfyniad da:Skabelon:Citat de:Vorlage:Zitat dsb:Pśedłoga:Citat es:Plantilla:Cita eo:Ŝablono:Citaĵo eu:Txantiloi:Aipua fa:الگو:نقل قول fi:Malline:Cquote fr:modèle:citation gl:Modelo:Cita gu:ઢાંચો:ઉક્તિ he:Template:ציטוט hi:साँचा:Quote hsb:Předłoha:Citat hu:Sablon:Idézet hy:Կաղապար:Քաղվածք id:Templat:Quote is:Snið:Tilvitnun it:Template:quote ja:Template:Quote ka:თარგი:ციტირება kk:Үлгі:Cquote ky:Калып:Цитата la:Formula:Locus lv:Veidne:Quotation mwl:Modelo:Quote no:Mal:Sitat os:Хуызæг:Cquote pl:Szablon:Cytat pt:Predefinição:Quote ro:Format:Cquote ru:Шаблон:Цитата sco:Template:Quote sh:Šablon:Citat sk:Šablóna:Citát sl:Predloga:Citatni blok sv:Mall:Citat </includeonly></text>

     <sha1>m90lwuu4k3wdwldcwackwm0e59ik5wz</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>34886</id>
   <revision>
     <id>2345989</id>
     <parentid>840536</parentid>
     <timestamp>2017-01-09T04:18:11Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>add plain</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="533" xml:space="preserve"><code style="white-space:nowrap">&lt;tag&gt;...&lt;&#47;tag&gt;</code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>5712d793ut16z9syevjrd9ahtnk492q</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>156423</id>
   <redirect title="Template:TemplateData header" />
   <revision>
     <id>1860349</id>
     <parentid>1860348</parentid>
     <timestamp>2015-08-25T09:13:32Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>1 revision imported from w:en:Template:TemplateDataHeader</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="58" xml:space="preserve">#REDIRECT Template:TemplateData header

Template:R from move</text>

     <sha1>bfnm7z66t4q2d8otfa0y3vtgkcwrfao</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>490722</id>
   <revision>
     <id>1860362</id>
     <parentid>1860361</parentid>
     <timestamp>2015-08-25T09:13:33Z</timestamp>
     <contributor>
       <username>Hashar</username>
       <id>81</id>
     </contributor>
     <minor/>
     <comment>12 revisions imported from w:en:Template:TemplateData_header</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="391" xml:space="preserve"><div class="templatedata-header">This is the TemplateData documentation for this template used by VisualEditor and other tools.

Quote </div><includeonly></includeonly><noinclude>

50px Template documentation[create]

</noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>20809</id>
   <revision>
     <id>3366281</id>
     <parentid>2476769</parentid>
     <timestamp>2019-08-17T13:05:32Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Tlx": Highly visible template:600+ transclusions ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="408" xml:space="preserve"><span style="font-family:&quot;Consolas&quot;, monospace;">{{Tlx}}</span><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>7weae3xv9bbea6yxobh4uj78gse15yb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Translatable</title>
   <ns>10</ns>
   <id>646480</id>
   <revision>
     <id>3445136</id>
     <parentid>2593122</parentid>
     <timestamp>2019-10-05T17:10:27Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Translatable": Fully protected via cascading protection, autoconfirmed protection is misleading ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="643" xml:space="preserve">Template:<noinclude>

{{ Template:TNTN |content=

Examples

Template:Translatable

Template:Translatable

Template:Translatable

}}

[[Category:Internationalization templates{{#translation:}}]] </noinclude></text>

     <sha1>3azv7v0c2ey3qixhczhrqr15p9fbofu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Xtag</title>
   <ns>10</ns>
   <id>156424</id>
   <revision>
     <id>2960413</id>
     <parentid>792025</parentid>
     <timestamp>2018-11-11T02:13:57Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <comment>fix links</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1364" xml:space="preserve"><code style="white-space:nowrap;">&lt;tag&gt;<!--nothing--></code><noinclude>
50px Template documentation[create]

</noinclude></text>

     <sha1>hbxw2ejdb4ie306193c5t32gs3ckjms</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>191978</id>
   <revision>
     <id>3392121</id>
     <parentid>3388613</parentid>
     <timestamp>2019-09-02T12:39:11Z</timestamp>
     <contributor>
       <username>AKlapper (WMF)</username>
       <id>790805</id>
     </contributor>
     <minor/>
     <comment>4 revisions imported from meta:Module:Arguments: See phab:T231001</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

-- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly.

local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it.

local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == then return nil else return val end else return val end end

local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end

local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end

local function tidyValNoChange(key, val) return val end

local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {}

--[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end

--[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', ) local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end

-- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end

-- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs

--[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end

--[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable)

local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end

--[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]]

metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end

metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end

local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end

metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end

local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end

metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>191985</id>
   <revision>
     <id>3580738</id>
     <parentid>3325222</parentid>
     <timestamp>2019-12-28T03:33:50Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>

<text bytes="35628" xml:space="preserve">-- This module implements

50px Template documentation[create]

.

-- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box')

-- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local i18n = mw.loadData('Module:Documentation/i18n') local p = {}

-- Often-used functions. local ugsub = mw.ustring.gsub


-- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes.


local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-type', cfgKey, expectType, type(msg)), 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error(require('Module:TNT').format('I18n/Documentation', 'cfg-error-msg-empty', '$' .. match, cfgKey), 4) end

local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end

p.message = message

local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end

p.makeWikilink = makeWikilink

local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end

p.makeCategoryLink = makeCategoryLink

local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end

p.makeUrlLink = makeUrlLink

local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ')</small>' end

p.makeToolbar = makeToolbar


-- Argument processing


local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= then return value else return nil end else return value end end }) return p[funcName](args) end end


-- Load TemplateStyles


p.main = function(frame) local parent = frame.getParent(frame) local output = p._main(parent.args) return frame:extensionTag{ name='templatestyles', args = { src= message('templatestyles-scr') } } .. frame:preprocess(output) end


-- Main function


function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from Template:Documentation/start box, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-class')) :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :done() :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end


-- Environment settings


function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]]

local env, envFuncs = {}, {}

-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end })

function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end

function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end

function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end

function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end

function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end

function envFuncs.printTitle() --[[ -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' --]] return env.templateTitle:subPageTitle(message('print-subpage')) end

function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end

function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end

function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end

function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end

function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end

return env end


-- Auxiliary templates


function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end

-- Build the table of arguments to pass to

. We need just two fields, "image" and "text".

local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text = local frame = mw.getCurrentFrame() local isPreviewing = frame:preprocess('1686') == -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text omargs.class = message('sandbox-class') local ret = '<div style="clear: both;"></div>' ret = ret .. messageBox.main('ombox', omargs) return ret end

function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local title = env.title local protectionLevels local protectionTemplate = message('protection-template') local namespace = title.namespace if not (protectionTemplate and (namespace == 10 or namespace == 828)) then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editLevels = protectionLevels.edit local moveLevels = protectionLevels.move if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then -- The page is full-move protected, or full, template, or semi-protected. local frame = mw.getCurrentFrame() return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} else return nil end end


-- Start box


p.startBox = makeInvokeFunc('_startBox')

function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = i18n['view-link-display'] data.editLinkDisplay = i18n['edit-link-display'] data.historyLinkDisplay = i18n['history-link-display'] data.purgeLinkDisplay = i18n['purge-link-display'] -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = i18n['create-link-display'] return data end

function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]]

local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end

local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'start-box-linkclasses' --> 'mw-editsection-like plainlinks' -- 'start-box-link-id' --> 'doc_editlinks' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {}

-- Heading local heading = args.heading -- Blank values are not removed. if heading == then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = i18n['template-namespace-heading'] elseif subjectSpace == 828 then -- Module namespace data.heading = i18n['module-namespace-heading'] elseif subjectSpace == 6 then -- File namespace data.heading = i18n['file-namespace-heading'] else data.heading = i18n['other-namespaces-heading'] end

-- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end

return data end

function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :addClass(message('header-div-class')) :tag('div') :addClass(message('heading-div-class')) :wikitext(data.heading) local links = data.links if links then sbox :tag('div') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end


-- Documentation content


p.content = makeInvokeFunc('_content')

function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. local cbox = mw.html.create('div') cbox :addClass(message('content-div-class')) :wikitext('\n' .. (content or ) .. '\n') return tostring(cbox) end

p.contentTitle = makeInvokeFunc('_contentTitle')

function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return end end


-- End box


p.endBox = makeInvokeFunc('_endBox')

function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment --]=]

-- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end

-- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end

-- Assemble the footer text field. local text = if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or ) -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or ) text = text .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or ) end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or ) --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. '<br />' .. printBlurb end end end

local ebox = mw.html.create('div') ebox :addClass(message('footer-div-class')) :wikitext(text) return tostring(ebox) end

function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editUrl = docTitle:fullUrl{action = 'edit'} local editDisplay = i18n['edit-link-display'] local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = i18n['history-link-display'] local historyLink = makeUrlLink(historyUrl, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = i18n['create-link-display'] local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end

function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end

function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end

function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end

function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end


-- Tracking categories


function p.addTrackingCategories(env) --[[

-- Check if

50px Template documentation[create]

is transcluded on a /doc or /testcases page.

-- @env - environment table containing title objects, etc., generated with p.getEnvironment

-- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have

--

50px Template documentation[create]

transcluded automatically.

--]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end

return p</text>

     <sha1>9yvmvx0tsymceaftthmygcc43fhym6a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>191986</id>
   <revision>
     <id>3347381</id>
     <parentid>3325246</parentid>
     <timestamp>2019-08-06T09:59:42Z</timestamp>
     <contributor>
       <username>Viztor</username>
       <id>351633</id>
     </contributor>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17778" xml:space="preserve">----------------------------------------------------------------------------------------------------

-- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values.


local _format = require('Module:TNT').format local function format(id) return _format('I18n/Documentation', id) end

local cfg = {} -- Do not edit this line.

cfg['templatestyles-scr'] = 'Module:Documentation/styles.css'


-- Protection template configuration


-- cfg['protection-template'] -- The name of the template that displays the protection icon (a padlock on enwiki). cfg['protection-template'] = 'pp-template'

-- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template'

--[[ -- cfg['protection-template-args'] -- Any arguments to send to the protection template. This should be a Lua table. -- For example, if the protection template is "pp-template", and the wikitext template invocation -- looks like "Template:Pp-template", then this table should look like "{docusage = 'yes'}".

--]]
cfg['protection-template-args'] = {docusage = 'yes'}

--[[


-- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.


--]]

-- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '40px'

--[[ -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. --]] cfg['sandbox-notice-pagetype-template'] = format('sandbox-notice-pagetype-template') cfg['sandbox-notice-pagetype-module'] = format('sandbox-notice-pagetype-module') cfg['sandbox-notice-pagetype-other'] = format('sandbox-notice-pagetype-other')

--[[ -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. --]] cfg['sandbox-notice-blurb'] = format('sandbox-notice-blurb') cfg['sandbox-notice-diff-blurb'] = format('sandbox-notice-diff-blurb') cfg['sandbox-notice-compare-link-display'] = format('sandbox-notice-compare-link-display')

--[[ -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. --]] cfg['sandbox-notice-testcases-blurb'] = format('sandbox-notice-testcases-blurb') cfg['sandbox-notice-testcases-link-display'] = format('sandbox-notice-testcases-link-display') cfg['sandbox-notice-testcases-run-blurb'] = format('sandbox-notice-testcases-run-blurb') cfg['sandbox-notice-testcases-run-link-display'] = format('sandbox-notice-testcases-run-link-display')

-- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes'


-- Start box configuration


-- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '50px'


-- Link box (end box) configuration


-- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = format('transcluded-from-blurb')

--[[ -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. --]] cfg['create-module-doc-blurb'] = format('create-module-doc-blurb')


-- Experiment blurb configuration


--[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = format('experiment-blurb-template') cfg['experiment-blurb-module'] = format('experiment-blurb-module')


-- Sandbox link configuration


-- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox'

-- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'

-- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'

-- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = format('sandbox-link-display')

-- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = format('sandbox-edit-link-display')

-- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = format('sandbox-create-link-display')

-- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = format('compare-link-display')

-- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1'

-- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = format('mirror-link-display')

-- cfg['mirror-link-preload'] -- The page to preload when a user clicks the "mirror" link. cfg['mirror-link-preload'] = 'Template:Documentation/mirror'


-- Test cases link configuration


-- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases'

-- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'

-- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'

-- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = format('testcases-link-display')

-- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = format('testcases-edit-link-display')

-- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = format('testcases-create-link-display')


-- Add categories blurb configuration


--[[ -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. --]] cfg['add-categories-blurb'] = format('add-categories-blurb')

-- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc'


-- Subpages link configuration


--[[ -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. --]] cfg['subpages-blurb'] = format('subpages-blurb')

--[[ -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. --]] cfg['subpages-link-display'] = format('subpages-link-display')

-- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = format('template-pagetype')

-- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = format('module-pagetype')

-- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = format('default-pagetype')


-- Doc link configuration


-- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc'

-- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace'

-- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload'

-- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc'


-- Print version configuration


-- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print'

-- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print'

-- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = format('print-blurb')

-- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true

-- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions'


-- HTML and CSS configuration


-- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation'

-- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-class'] = 'ts-doc-doc' cfg['header-div-class'] = 'ts-doc-header' cfg['heading-div-class'] = 'ts-doc-heading' cfg['content-div-class'] = 'ts-doc-content' cfg['footer-div-class'] = 'ts-doc-footer plainlinks'

cfg['sandbox-class'] = 'ts-doc-sandbox'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'ts-tlinks-tlinks mw-editsection-like plainlinks'

-- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks'


-- Tracking category configuration


-- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true

-- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage'

--[[


-- End configuration -- -- Don't edit anything below this line.


--]]

return cfg</text>

     <sha1>kyp1e7ee5n31prtcib0y6nrcssgz2pk</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/i18n</title>
   <ns>828</ns>
   <id>933426</id>
   <revision>
     <id>3580736</id>
     <parentid>3580735</parentid>
     <timestamp>2019-12-28T03:33:21Z</timestamp>
     <contributor>
       <username>94rain</username>
       <id>14443205</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Documentation/i18n": Highly visible page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1691" xml:space="preserve">local format = require('Module:TNT').format

local i18n = {}

i18n['cfg-error-msg-type'] = format('I18n/Documentation', 'cfg-error-msg-type') i18n['cfg-error-msg-empty'] = format('I18n/Documentation', 'cfg-error-msg-empty')

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. i18n['template-namespace-heading'] = format('I18n/Documentation', 'template-namespace-heading')

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. i18n['module-namespace-heading'] = format('I18n/Documentation', 'module-namespace-heading')

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. i18n['file-namespace-heading'] = format('I18n/Documentation', 'file-namespace-heading')

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. i18n['other-namespaces-heading'] = format('I18n/Documentation', 'other-namespaces-heading')

-- cfg['view-link-display'] -- The text to display for "view" links. i18n['view-link-display'] = format('I18n/Documentation', 'view-link-display')

-- cfg['edit-link-display'] -- The text to display for "edit" links. i18n['edit-link-display'] = format('I18n/Documentation', 'edit-link-display')

-- cfg['history-link-display'] -- The text to display for "history" links. i18n['history-link-display'] = format('I18n/Documentation', 'history-link-display')

-- cfg['purge-link-display'] -- The text to display for "purge" links. i18n['purge-link-display'] = format('I18n/Documentation', 'purge-link-display')

-- cfg['create-link-display'] -- The text to display for "create" links. i18n['create-link-display'] = format('I18n/Documentation', 'create-link-display')

return i18n</text>

     <sha1>i27qt76cptbbpjtsh3j4x87t48x7xds</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>933326</id>
   <revision>
     <id>3369888</id>
     <parentid>3325224</parentid>
     <timestamp>2019-08-19T20:39:14Z</timestamp>
     <contributor>
       <username>Tacsipacsi</username>
       <id>561046</id>
     </contributor>
     <comment>clear:both</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1571" xml:space="preserve">.ts-doc-sandbox .mbox-image	{

padding:.75em 0 .75em .75em; }

.ts-doc-doc { clear: both; background-color: #eaf3ff; border: 1px solid #a3caff; margin-top: 1em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header { background-color: #c2dcff; padding: .642857em 1em .5em; border-top-left-radius: 2px; border-top-right-radius: 2px; }

.ts-doc-header .ts-tlinks-tlinks { line-height: 24px; margin-left: 0; }

.ts-doc-header .ts-tlinks-tlinks a.external { color: #0645ad; }

.ts-doc-header .ts-tlinks-tlinks a.external:visited { color: #0b0080; }

.ts-doc-header .ts-tlinks-tlinks a.external:active { color: #faa700; }

.ts-doc-content { padding: .214286em 1em; }

.ts-doc-content:after { content: ; clear: both; display: block; }

.ts-doc-heading { display: inline-block; padding-left: 30px; background: url(//upload.wikimedia.org/wikipedia/commons/f/fb/OOjs_UI_icon_puzzle-ltr.svg) center left/24px 24px no-repeat; height: 24px; line-height: 24px; font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.ts-doc-content > *:first-child, .ts-doc-footer > *:first-child { margin-top: .5em; }

.ts-doc-content > *:last-child, .ts-doc-footer > *:last-child { margin-bottom: .5em; }

.ts-doc-footer { background-color: #eaf3ff; border: 1px solid #a3caff; padding: .214286em 1em; margin-top: .214286em; font-style: italic; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

@media all and (min-width: 720px) { .ts-doc-header .ts-tlinks-tlinks { float: right; } }</text>

     <sha1>fylxgl4rpcov4jxknebr4z44olo96sz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>191976</id>
   <revision>
     <id>3313003</id>
     <parentid>3313002</parentid>
     <timestamp>2019-07-12T22:33:01Z</timestamp>
     <contributor>
       <username>Jdforrester (WMF)</username>
       <id>574543</id>
     </contributor>
     <minor/>
     <comment>9 revisions imported from w:en:Module:Message_box: Page about technical change that was posted to a local wiki</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17776" xml:space="preserve">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox,

,

, Template:Cmbox and Template:Fmbox.

-- Load necessary modules. require('Module:No globals') local getArgs local yesno = require('Module:Yesno')

-- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage()

-- Define constants local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}


-- Helper functions


local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end

local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {}

-- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()

-- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end

-- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end

-- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of Module:Category handler. obj.hasCategories = false

return setmetatable(obj, MessageBox) end

function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end

function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end

function MessageBox:setParameters() local args = self.args local cfg = self.cfg

-- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

-- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'

-- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) )

-- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs

-- Set text style. self.textstyle = args.textstyle

-- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end

-- Process data for collapsible text fields. At the moment these are only -- used in Template:Ambox. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end

-- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end

-- Get other values. self.fix = args.fix ~= and args.fix or nil local date if args.date and args.date ~= then date = args.date elseif args.date == and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <small class='date-container'>(<span class='date'>%s</span>)</small>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

-- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end

-- Set the below row. self.below = cfg.below and args.below

-- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('%s', self.typeImage or 'Imbox notice.png', imageSize) end end

-- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end

function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg

if not cfg.allowMainspaceCategories then return nil end

local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end

-- The following is roughly equivalent to the old Template:Ambox/category. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end

function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg

-- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end

-- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end

function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or ) .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end

function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end

function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- Module:Category handler. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end

function MessageBox:export() local root = mw.html.create()

-- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s%s%s</code> has been incorrectly substituted.', mw.text.nowiki('Template:'), self.name, self.name, mw.text.nowiki('') )) end

-- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation')

if self.attrs then boxTable:attr(self.attrs) end

-- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end

-- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) and not self.isSmall then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('small') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end

-- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end

-- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or )) end

-- Add categories. root:wikitext(self:renderCategories() or nil)

return tostring(root) end


-- Exports


local p, mt = {}, {}

function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end

function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end

function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end

return setmetatable(p, mt)</text>

     <sha1>jxxabz8imuheyjlrvf8pyk1zbhdiz42</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>317688</id>
   <revision>
     <id>3388615</id>
     <parentid>3313031</parentid>
     <timestamp>2019-08-30T05:44:00Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>15026018</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:No globals": Highly visible template: Redundant to current transclusion on a cascading protected page, but better safe than sorry ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="458" xml:space="preserve">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then -- perf optimization here and below: do not load Module:TNT unless there is an error error(require('Module:TNT').format('I18n/No globals', 'err-read', tostring(k)), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error(require('Module:TNT').format('I18n/No globals', 'err-write', tostring(k)), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>s0drk5a3gn0y3tu3a6ay5f8w1mc8lqo</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TNT</title>
   <ns>828</ns>
   <id>649383</id>
   <revision>
     <id>3522878</id>
     <parentid>3388611</parentid>
     <timestamp>2019-11-27T11:15:52Z</timestamp>
     <contributor>
       <username>Bawolff</username>
       <id>24267</id>
     </contributor>
     <comment>Give a more useful error message if jsonconfig is missing. There have been three questions about this on the support desk from third party folks copying this template.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6220" xml:space="preserve">--

-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) -- This module allows any template or module to be copy/pasted between -- wikis without any translation changes. All translation text is stored -- in the global Data:*.tab pages on Commons, and used everywhere. -- -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules -- -- ATTENTION: -- Please do NOT rename this module - it has to be identical on all wikis. -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT -- Please do not modify it anywhere else, as it may get copied and override your changes. -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT -- -- DESCRIPTION: -- The "msg" function uses a Commons dataset to translate a message -- with a given key (e.g. source-table), plus optional arguments -- to the wiki markup in the current content language. -- Use lang=xx to set language. Example: -- -- Script error: No such module "TNT". <!-- optional parameter --> -- -- -- The "doc" function will generate the <templatedata> parameter documentation for templates. -- This way all template parameters can be stored and localized in a single Commons dataset. -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons. -- -- Script error: No such module "TNT". -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab -- if the current page is Template:Graph:Lines/doc --

local p = {} local i18nDataset = 'I18n/Module:TNT.tab'

-- Forward declaration of the local functions local sanitizeDataset, loadData, link, formatMessage

function p.msg(frame) local dataset, id local params = {} local lang = nil for k, v in pairs(frame.args) do if k == 1 then dataset = mw.text.trim(v) elseif k == 2 then id = mw.text.trim(v) elseif type(k) == 'number' then table.insert(params, mw.text.trim(v)) elseif k == 'lang' and v ~= '_' then lang = mw.text.trim(v) end end return formatMessage(dataset, id, params, lang) end

-- Identical to p.msg() above, but used from other lua modules -- Parameters: name of dataset, message key, optional arguments -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.format(dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('format', 1, dataset, 'string') checkType('format', 2, key, 'string') return formatMessage(dataset, key, {...}) end


-- Identical to p.msg() above, but used from other lua modules with the language param -- Parameters: language code, name of dataset, message key, optional arguments -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset') function p.formatInLanguage(lang, dataset, key, ...) local checkType = require('libraryUtil').checkType checkType('formatInLanguage', 1, lang, 'string') checkType('formatInLanguage', 2, dataset, 'string') checkType('formatInLanguage', 3, key, 'string') return formatMessage(dataset, key, {...}, lang) end

-- Obsolete function that adds a 'c:' prefix to the first param. -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab' function p.link(frame) return link(frame.args[1]) end

function p.doc(frame) local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1]) return frame:extensionTag('templatedata', p.getTemplateData(dataset)) .. formatMessage(i18nDataset, 'edit_doc', {link(dataset)}) end

function p.getTemplateData(dataset) -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages local data = loadData(dataset) local names = {} for _, field in pairs(data.schema.fields) do table.insert(names, field.name) end

local params = {} local paramOrder = {} for _, row in pairs(data.data) do local newVal = {} local name = nil for pos, val in pairs(row) do local columnName = names[pos] if columnName == 'name' then name = val else newVal[columnName] = val end end if name then params[name] = newVal table.insert(paramOrder, name) end end

-- Work around json encoding treating {"1":{...}} as an [{...}] params['zzz123']=

local json = mw.text.jsonEncode({ params=params, paramOrder=paramOrder, description=data.description })

json = string.gsub(json,'"zzz123":"",?', "")

return json end

-- Local functions

sanitizeDataset = function(dataset) if not dataset then return nil end dataset = mw.text.trim(dataset) if dataset == then return nil elseif string.sub(dataset,-4) ~= '.tab' then return dataset .. '.tab' else return dataset end end

loadData = function(dataset, lang) dataset = sanitizeDataset(dataset) if not dataset then error(formatMessage(i18nDataset, 'error_no_dataset', {})) end

-- Give helpful error to thirdparties who try and copy this module. if not mw.ext or not mw.ext.data or not mw.ext.data.get then error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) end

local data = mw.ext.data.get(dataset, lang)

if data == false then if dataset == i18nDataset then -- Prevent cyclical calls error('Missing Commons dataset ' .. i18nDataset) else error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) end end return data end

-- Given a dataset name, convert it to a title with the 'commons:data:' prefix link = function(dataset) return 'c:Data:' .. mw.text.trim(dataset or ) end

formatMessage = function(dataset, key, params, lang) for _, row in pairs(loadData(dataset, lang).data) do local id, msg = unpack(row) if id == key then local result = mw.message.newRawMessage(msg, unpack(params or {})) return result:plain() end end if dataset == i18nDataset then -- Prevent cyclical calls error('Invalid message key "' .. key .. '"') else error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)})) end end

return p</text>

     <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template translation</title>
   <ns>828</ns>
   <id>131816</id>
   <revision>
     <id>3497223</id>
     <parentid>3445117</parentid>
     <timestamp>2019-11-06T02:33:54Z</timestamp>
     <contributor>
       <username>Krinkle</username>
       <id>135822</id>
     </contributor>
     <comment>Add fallback to _getLanguageSubpage for content language. Used by Template:Pagelang</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="11977" xml:space="preserve">local this = {}

function this.checkLanguage(subpage, default)

   --[[Check first if there's an any invalid character that would cause the
       mw.language.isKnownLanguageTag function() to throw an exception:
       - all ASCII controls in [\000-\031\127],
       - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
       - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
       - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
       All other characters are accepted, including space and all non-ASCII
       characters (including \192, which is invalid in UTF-8).
   --]]
   if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
   --[[However "SupportedLanguages" are too restrictive, as they discard many
       valid BCP47 script variants (only because MediaWiki still does not
       define automatic transliterators for them, e.g. "en-dsrt" or
       "fr-brai" for French transliteration in Braille), and country variants,
       (useful in localized data, even if they are no longer used for
       translations, such as zh-cn, also useful for legacy codes).
       We want to avoid matching subpagenames containing any uppercase letter,
       (even if they are considered valid in BCP 47, in which they are
       case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
       they are not "KnownLanguageTags" for MediaWiki).
       To be more restrictive, we exclude any character
       * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
         or does not start by a letter or does not finish by a letter or digit;
       * or that has more than 8 characters between hyphens;
       * or that has two hyphens;
       * or with specific uses in template subpages and unusable as languages.
   --]]
   or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
   and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
   and string.find(subpage, "%-%-") == nil
   and subpage ~= "doc"
   and subpage ~= "layout"
   and subpage ~= "sandbox"
   and subpage ~= "testcases"
   and subpage ~= "init"
   and subpage ~= "preload"
   then
       return subpage
   end
   -- Otherwise there's currently no known language subpage
   return default

end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from templates.
   ]]

function this.getLanguageSubpage(frame) local title = frame and frame.args[1] if not title or title == then title = mw.title.getCurrentTitle() end return this._getLanguageSubpage(title) end

--[[Get the last subpage of an arbitrary page if it is a translation.

   To be used from Lua.
   ]]

function this._getLanguageSubpage(title) if type(title) == 'string' then title = mw.title.new(title) end if not title then -- invalid title return mw.language.getContentLanguage():getCode() end --[[This code does not work in all namespaces where the Translate tool works. -- It works in the main namespace on Meta because it allows subpages there -- It would not work in the main namespace of English Wikipedia (but the -- articles are monolignual on that wiki). -- On Meta-Wiki the main space uses subpages and its pages are translated. -- The Translate tool allows translatng pages in all namespaces, even if -- the namespace officially does not have subpages. -- On Meta-Wiki the Category namespace still does not have subpages enabled, -- even if they would be very useful for categorizing templates, that DO have -- subpages (for documentatio and tstboxes pages). This is a misconfiguration -- bug of Meta-Wiki. The work-around is to split the full title and then -- get the last titlepart. local subpage = title.subpageText --]] local titleparts = mw.text.split(title.fullText, '/') local subpage = titleparts[#titleparts] return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode()) end

--[[Get the last subpage of the current page if it is a translation.

   ]]

function this.getCurrentLanguageSubpage() return this._getLanguageSubpage(mw.title.getCurrentTitle()) end

--[[Get the first part of the language code of the subpage, before the '-'.

   ]]

function this.getMainLanguageSubpage() parts = mw.text.split( this.getCurrentLanguageSubpage(), '-' ) return parts[1] end

--[[Get the last subpage of the current frame if it is a translation.

   Not used locally.
   ]]

function this.getFrameLanguageSubpage(frame) return this._getLanguageSubpage(frame:getParent():getTitle()) end

--[[Get the language of the current page.

   Not used locally.
   ]]

function this.getLanguage()

   local subpage = mw.title.getCurrentTitle().subpageText
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

--[[Get the language of the current frame.

   Not used locally.
   ]]

function this.getFrameLanguage(frame)

   local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
   local subpage = titleparts[#titleparts]
   return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())

end

function this.title(namespace, basepagename, subpage)

   local message, title
   local pagename = basepagename
   if (subpage or ) ~= 
   then
       pagename = pagename .. '/' .. subpage
   end
   local valid, title = xpcall(function()
           return mw.title.new(pagename, namespace) -- costly
       end, function(msg) -- catch undocumented exception (!?)
           -- thrown when namespace does not exist. The doc still
           -- says it should return a title, even in that case...
           message = msg
       end)
   if valid and title ~= nil and (title.id or 0) ~= 0
   then
       return title
   end
   return { -- "pseudo" mw.title object with id = nil in case of error
       prefixedText = pagename, -- the only property we need below
       message = message -- only for debugging
   }

end

--[[If on a translation subpage (like Foobar/de), this function returns

   a given template in the same language, if the translation is available.
   Otherwise, the template is returned in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNTN.
   This version does not expand the returned template name: this solves the
   problem of self-recursion in TNT when translatable templates need themselves
   to transclude other translable templates (such as Tnavbar).
   ]]

function this.getTranslatedTemplate(frame, withStatus)

   local args = frame.args
   local pagename = args['template']
   
   --[[Check whether the pagename is actually in the Template namespace, or
       if we're transcluding a main-namespace page.
       (added for backward compatibility of Template:TNT)
       ]]
   local title
   local namespace = args['tntns'] or 
   if (namespace ~= ) -- Checks for tntns parameter for custom ns.
   then
       title = this.title(namespace, pagename) -- Costly
   else -- Supposes that set page is in ns10.
   	namespace = 'Template'
       title = this.title(namespace, pagename) -- Costly
       if title.id == nil
       then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
   	    namespace = 
           title = this.title(namespace, pagename) -- Costly
       end
   end
   
   -- Get the last subpage and check if it matches a known language code.
   local subpage = args['uselang'] or 
   if (subpage == )
   then
       subpage = this.getCurrentLanguageSubpage()
   end
   if (subpage == )
   then
       -- Check if a translation of the pagename exists in English
       local newtitle = this.title(namespace, pagename, 'en') -- Costly
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   else
       -- Check if a translation of the pagename exists in that language
       local newtitle = this.title(namespace, pagename, subpage) -- Costly
       if newtitle.id == nil
       then
           -- Check if a translation of the pagename exists in English
           newtitle = this.title(namespace, pagename, 'en') -- Costly
       end
       -- Use the translation when it exists
       if newtitle.id ~= nil
       then
           title = newtitle
       end
   end
   -- At this point the title should exist
   if withStatus then
   	-- status returned to Lua function below
       return title.prefixedText, title.id ~= nil
   else
   	-- returned directly to MediaWiki
       return title.prefixedText
   end

end

--[[If on a translation subpage (like Foobar/de), this function renders

   a given template in the same language, if the translation is available.
   Otherwise, the template is rendered in its default language, without
   modification.
   This is aimed at replacing the current implementation of Template:TNT.
   
   Note that translatable templates cannot transclude themselves other
   translatable templates, as it will recurse on TNT. Use TNTN instead
   to return only the effective template name to expand externally, with
   template parameters also provided externally.
   ]]

function this.renderTranslatedTemplate(frame) local title, found = this.getTranslatedTemplate(frame, true)

   -- At this point the title should exist prior to performing the expansion
   -- of the template, otherwise render a red link to the missing page
   -- (resolved in its assumed namespace). If we don't tet this here, a
   -- script error would be thrown. Returning a red link is consistant with
   -- MediaWiki behavior when attempting to transclude inexistant templates.

if not found then return '' .. title .. '' end

   -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
   -- Then render the pagename.
   local args = frame.args
   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   if (args['noshift'] or ) == 
   then
       for k, v in pairs(pargs) do
           -- numbered args >= 1 need to be shifted
           local n = tonumber(k) or 0
           if (n > 0)
           then
               if (n >= 2)
               then
                   arguments[n - 1] = v
               end
           else
               arguments[k] = v
           end
       end
   else -- special case where TNT is used as autotranslate
   	-- (don't shift again what is shifted in the invokation)
       for k, v in pairs(pargs) do
           arguments[k] = v
       end
   end
   arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
   arguments['tntns'] = nil -- discard the specified namespace override
   arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
   arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
   
   return frame:expandTemplate{title = ':' .. title, args = arguments}

end

--[[A helper for mocking TNT in Special:TemplateSandbox. TNT breaks

   TemplateSandbox; mocking it with this method means templates won't be
   localized but at least TemplateSandbox substitutions will work properly.
   Won't work with complex uses.
   ]]

function this.mockTNT(frame)

   local pargs = (frame:getParent() or {}).args
   local arguments = {}
   for k, v in pairs(pargs) do
       -- numbered args >= 1 need to be shifted
       local n = tonumber(k) or 0
       if (n > 0)
       then
           if (n >= 2)
           then
               arguments[n - 1] = v
           end
       else
           arguments[k] = v
       end
   end
   if not pargs[1]
   then
   	return 

end

   return frame:expandTemplate{title = 'Template:' .. pargs[1], args = arguments}

end

return this</text>

     <sha1>8l9rmujss5n6rdiu7joe3mg3btet7x2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>191981</id>
   <revision>
     <id>3315904</id>
     <parentid>3313118</parentid>
     <timestamp>2019-07-14T23:27:52Z</timestamp>
     <contributor>
       <username>Shirayuki</username>
       <id>472859</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Yesno": High-risk module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template .

return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
   </revision>
 </page>

</mediawiki>