Template:Key press

From WikiName
Revision as of 19:22, 10 December 2014 by Wittywit (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: 4px 4px 4px #CCC; -webkit-box-shadow: 4px 4px 4px #CCC; box-shadow: 4px 4px 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Template:Thinsp<!-- -->{{#if: |Template:Thinsp{{{2}}}}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">the button</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:|icon |Category&nbsp;[[:Category:{{{2}}}|{{{2}}}]] |[[:Category:{{{1}}}|{{{1}}}]]}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;text&quot;" enclose="&quot;none&quot;">{{{1}}}</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}><span style="color:{{#if:|#8B0000|#696969}};">{{{1}}}</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}>{{{1}}}</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:{{{1}}}

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = {{{1}}} }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:Tc → <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: A; -webkit-border-radius: A; border-radius: A;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: A 4px 4px #CCC; -webkit-box-shadow: A 4px 4px #CCC; box-shadow: A 4px 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>A<!-- -->{{#if: |Template:Thinsp{{{2}}}}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">A</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:A|icon |Category&nbsp;[[:Category:{{{2}}}|{{{2}}}]] |A}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:A;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;text&quot;" enclose="&quot;none&quot;">A</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}><span style="color:{{#if:|#8B0000|#696969}};">A</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}>A</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>A</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>A</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:a

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = A }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(A, ); background-image: -o-linear-gradient(A, ); background-image: -webkit-linear-gradient(A, ); background-image: linear-gradient(Template:Linear-gradient/legacy, );</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: A

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = A }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:|A}}">{{#if:|{{{2}}}|A}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:|A|0.6em}};">A</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:|font-size:A;}}">A</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">A</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:A|A&#61;}}</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:{{{2}}}| |&#124;}}&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:a

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:

|<span style="font-size:A;"></span> |<span style="font-size:90%;">A</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>A</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=A| -{{#invoke:String|len|s={{{2}}}}} |ignore_errors=true}}||yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>A</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:pair
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;A{{#if:|&#32;{{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:A|!--||&gt;}}...

}}{{#switch:pair

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:A|!--|--&gt;|&lt;&#47;A&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

A </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:A |Template:UnicodeATemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;A&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if A is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:A;">{{{2}}}</span>]]
| A

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:A|A| tlc&#124;...}}<!--

-->{{#ifeq:x|| &#124;{{{2}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:A|: <!--i.e. if A's first character is a colon,
             then:--> |A<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:A|A|Key press}}
                        | #default = {{#if:A|A|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:A|A|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{2}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{3}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->A<!--
                         -->{{#if:  |&#124;{{{2}}}}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">A</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>A</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>A</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |{{{2}}}<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:A|linked |{{{2}}}
       | A{{#if:|<nowiki>:</nowiki>{{{2}}}}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: A }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki>

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:Tc → <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:P|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: Alt; -webkit-border-radius: Alt; border-radius: Alt;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: Alt P 4px #CCC; -webkit-box-shadow: Alt P 4px #CCC; box-shadow: Alt P 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Alt<!-- -->{{#if:P |Template:ThinspP}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:Alt|icon |Category&nbsp;P |P}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:Alt;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;P&quot;" enclose="&quot;none&quot;">Alt</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:P|title="P"|}}><span style="color:{{#if:|#8B0000|#696969}};">Alt</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:P|title="P"|}}>Alt</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Alt</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:alt

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = Alt }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(Alt, P); background-image: -o-linear-gradient(Alt, P); background-image: -webkit-linear-gradient(Alt, P); background-image: linear-gradient(Template:Linear-gradient/legacy, P);</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: Alt

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = Alt }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:P|Alt}}">{{#if:P|P|Alt}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:P|Alt|0.6em}};">P</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:P|font-size:Alt;}}">P</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">Alt</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:Alt|Alt&#61;}}P</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:P|P |&#124;}}P&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:alt

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:P

|<span style="font-size:Alt;">P</span> |<span style="font-size:90%;">Alt</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=Alt| -{{#invoke:String|len|s=P}} |ignore_errors=true}}|P|yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Alt</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:P
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;Alt{{#if:|&#32;{{{params}}}}}

}}{{#switch:P

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:Alt|!--||&gt;}}...

}}{{#switch:P

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:Alt|!--|--&gt;|&lt;&#47;Alt&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Alt </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:Alt |Template:UnicodeAltTemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;Alt&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if Alt is a percentage)-->
| <span style="font-size:Alt;">P</span>
| P

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:Alt|Alt| tlc&#124;...}}<!--

-->{{#ifeq:P|P| &#124;P | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:A|: <!--i.e. if Alt's first character is a colon,
             then:--> |Alt<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:Alt|Alt|Key press}}
                        | #default = {{#if:Alt|Alt|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:Alt|Alt|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:P|¬ | |&#124;P}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{3}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->Alt<!--
                         -->{{#if:P  |&#124;P}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |P<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:Alt|linked |P
       | ALT{{#if:P|<nowiki>:</nowiki>P}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: Alt }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki>

Template:Tc → <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:Alt|+Template:Key press/core}}<!-- -->{{#if:Del|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: Ctrl; -webkit-border-radius: Ctrl; border-radius: Ctrl;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: Ctrl Alt Del #CCC; -webkit-box-shadow: Ctrl Alt Del #CCC; box-shadow: Ctrl Alt Del #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Ctrl<!-- -->{{#if:Alt |Template:ThinspAlt}}<!-- -->{{#if:Del |Template:ThinspDel}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:Ctrl|icon |Category&nbsp;Del |Alt}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:Ctrl;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;Alt&quot;" enclose="&quot;none&quot;">Ctrl</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:Alt|title="Alt"|}}><span style="color:{{#if:|#8B0000|#696969}};">Ctrl</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:Alt|title="Alt"|}}>Ctrl</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:ctrl

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = Ctrl }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(Ctrl, Alt); background-image: -o-linear-gradient(Ctrl, Alt); background-image: -webkit-linear-gradient(Ctrl, Alt); background-image: linear-gradient(Template:Linear-gradient/legacy, Alt);</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: Ctrl

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = Ctrl }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:Alt|Ctrl}}">{{#if:Alt|Alt|Ctrl}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:Alt|Ctrl|0.6em}};">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:Alt|font-size:Ctrl;}}">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">Ctrl</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:Ctrl|Ctrl&#61;}}Alt</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:Alt|Alt |&#124;}}Alt&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:ctrl

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:Alt

|<span style="font-size:Ctrl;">Alt</span> |<span style="font-size:90%;">Ctrl</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=Ctrl| -{{#invoke:String|len|s=Alt}} |ignore_errors=true}}|Alt|yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:Alt
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;Ctrl{{#if:|&#32;{{{params}}}}}

}}{{#switch:Alt

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:Ctrl|!--||&gt;}}...

}}{{#switch:Alt

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:Ctrl|!--|--&gt;|&lt;&#47;Ctrl&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Ctrl </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:Ctrl |Template:UnicodeCtrlTemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;Ctrl&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if Ctrl is a percentage)-->
| <span style="font-size:Ctrl;">Del</span>
| Alt

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:Ctrl|Ctrl| tlc&#124;...}}<!--

-->{{#ifeq:Alt|Alt| &#124;Alt | }}<!-- -->{{#ifeq:Del|Del| &#124;Del | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:C|: <!--i.e. if Ctrl's first character is a colon,
             then:--> |Ctrl<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:Ctrl|Ctrl|Key press}}
                        | #default = {{#if:Ctrl|Ctrl|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:Ctrl|Ctrl|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:Alt|¬ | |&#124;Alt}}<!--
-->{{#ifeq:Del|¬ | |&#124;Del}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->Ctrl<!--
                         -->{{#if:Alt  |&#124;Alt}}<!--
                         -->{{#if:Del  |&#124;Del}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if:Del |ALT<nowiki>:</nowiki>Del
    | {{#ifeq:Ctrl|linked |ALT
       | CTRL{{#if:Alt|<nowiki>:</nowiki>Alt}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: Ctrl }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki>

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:Tlc → <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: Ctrl; -webkit-border-radius: Ctrl; border-radius: Ctrl;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: Ctrl 4px 4px #CCC; -webkit-box-shadow: Ctrl 4px 4px #CCC; box-shadow: Ctrl 4px 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Ctrl<!-- -->{{#if: |Template:Thinsp{{{2}}}}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:Ctrl|icon |Category&nbsp;[[:Category:{{{2}}}|{{{2}}}]] |Ctrl}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:Ctrl;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;text&quot;" enclose="&quot;none&quot;">Ctrl</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}><span style="color:{{#if:|#8B0000|#696969}};">Ctrl</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}>Ctrl</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:ctrl

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = Ctrl }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(Ctrl, ); background-image: -o-linear-gradient(Ctrl, ); background-image: -webkit-linear-gradient(Ctrl, ); background-image: linear-gradient(Template:Linear-gradient/legacy, );</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: Ctrl

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = Ctrl }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:|Ctrl}}">{{#if:|{{{2}}}|Ctrl}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:|Ctrl|0.6em}};">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:|font-size:Ctrl;}}">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">Ctrl</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:Ctrl|Ctrl&#61;}}</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:{{{2}}}| |&#124;}}&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:ctrl

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:

|<span style="font-size:Ctrl;"></span> |<span style="font-size:90%;">Ctrl</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=Ctrl| -{{#invoke:String|len|s={{{2}}}}} |ignore_errors=true}}||yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:pair
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;Ctrl{{#if:|&#32;{{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:Ctrl|!--||&gt;}}...

}}{{#switch:pair

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:Ctrl|!--|--&gt;|&lt;&#47;Ctrl&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Ctrl </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:Ctrl |Template:UnicodeCtrlTemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;Ctrl&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if Ctrl is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:Ctrl;">{{{2}}}</span>]]
| Ctrl

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:Ctrl|Ctrl| tlc&#124;...}}<!--

-->{{#ifeq:x|| &#124;{{{2}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:C|: <!--i.e. if Ctrl's first character is a colon,
             then:--> |Ctrl<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:Ctrl|Ctrl|Key press}}
                        | #default = {{#if:Ctrl|Ctrl|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:Ctrl|Ctrl|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{2}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{3}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->Ctrl<!--
                         -->{{#if:  |&#124;{{{2}}}}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">Ctrl</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Ctrl</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |{{{2}}}<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:Ctrl|linked |{{{2}}}
       | CTRL{{#if:|<nowiki>:</nowiki>{{{2}}}}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: Ctrl }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki> + <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: Alt; -webkit-border-radius: Alt; border-radius: Alt;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: Alt 4px 4px #CCC; -webkit-box-shadow: Alt 4px 4px #CCC; box-shadow: Alt 4px 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Alt<!-- -->{{#if: |Template:Thinsp{{{2}}}}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:Alt|icon |Category&nbsp;[[:Category:{{{2}}}|{{{2}}}]] |Alt}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:Alt;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;text&quot;" enclose="&quot;none&quot;">Alt</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}><span style="color:{{#if:|#8B0000|#696969}};">Alt</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}>Alt</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Alt</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:alt

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = Alt }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(Alt, ); background-image: -o-linear-gradient(Alt, ); background-image: -webkit-linear-gradient(Alt, ); background-image: linear-gradient(Template:Linear-gradient/legacy, );</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: Alt

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = Alt }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:|Alt}}">{{#if:|{{{2}}}|Alt}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:|Alt|0.6em}};">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:|font-size:Alt;}}">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">Alt</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:Alt|Alt&#61;}}</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:{{{2}}}| |&#124;}}&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:alt

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:

|<span style="font-size:Alt;"></span> |<span style="font-size:90%;">Alt</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=Alt| -{{#invoke:String|len|s={{{2}}}}} |ignore_errors=true}}||yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Alt</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:pair
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;Alt{{#if:|&#32;{{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:Alt|!--||&gt;}}...

}}{{#switch:pair

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:Alt|!--|--&gt;|&lt;&#47;Alt&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Alt </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:Alt |Template:UnicodeAltTemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;Alt&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if Alt is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:Alt;">{{{2}}}</span>]]
| Alt

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:Alt|Alt| tlc&#124;...}}<!--

-->{{#ifeq:x|| &#124;{{{2}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:A|: <!--i.e. if Alt's first character is a colon,
             then:--> |Alt<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:Alt|Alt|Key press}}
                        | #default = {{#if:Alt|Alt|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:Alt|Alt|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{2}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{3}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->Alt<!--
                         -->{{#if:  |&#124;{{{2}}}}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">Alt</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Alt</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |{{{2}}}<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:Alt|linked |{{{2}}}
       | ALT{{#if:|<nowiki>:</nowiki>{{{2}}}}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: Alt }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki> + <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>Wikipedia</sitename>
   <dbname>enwiki</dbname>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.25wmf10</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">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia 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="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
     <namespace key="2600" case="first-letter">Topic</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Key press</title>
   <ns>10</ns>
   <id>13183858</id>
   <revision>
     <id>612135117</id>
     <parentid>578304145</parentid>
     <timestamp>2014-06-08T22:16:02Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>add chain fifth-ninth...</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="975">Template:Key press/core<!--

-->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|+Template:Key press/core}}<!-- -->{{#if:|}}<noinclude> Template:Documentation <!-- add category and language links to the /doc sub-page, not here --> </noinclude></text>

     <sha1>rkr0htmgsqbwomyzkzrgu1l5vg7h3wm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!((</title>
   <ns>10</ns>
   <id>36487505</id>
   <revision>
     <id>620194580</id>
     <parentid>620193684</parentid>
     <timestamp>2014-08-07T05:34:55Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:!((: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">[[<noinclude>Template:Documentation</noinclude></text>
     <sha1>kx6wfr2em4x51ldy401n0q58z3lvxb8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:!))</title>
   <ns>10</ns>
   <id>36487561</id>
   <redirect title="Template:))!" />
   <revision>
     <id>503227525</id>
     <timestamp>2012-07-20T04:33:11Z</timestamp>
     <contributor>
       <username>Vanisaac</username>
       <id>1032946</id>
     </contributor>
     <comment>Vanisaac moved page Template:!)) to Template:))!: parity with template:)!</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="26">#REDIRECT Template:))!</text>
     <sha1>5g9ex418xvscsnyrsae4dnxgyapzbmq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:))!</title>
   <ns>10</ns>
   <id>36487511</id>
   <revision>
     <id>620194518</id>
     <parentid>620193376</parentid>
     <timestamp>2014-08-07T05:34:06Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:))!: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="42">]]<noinclude>Template:Documentation</noinclude></text>
     <sha1>9eedfl8595z67nnifo09swq3y20vmvs</sha1>
   </revision>
 </page>
 <page>
   <title>Template:;</title>
   <ns>10</ns>
   <id>24389988</id>
   <revision>
     <id>579820375</id>
     <parentid>328698152</parentid>
     <timestamp>2013-11-02T02:29:16Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:;: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="138">&#59;<noinclude>

Template:Documentation <!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude></text>

     <sha1>jv515gqjn3e60s98b0od6potfps8h7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:=</title>
   <ns>10</ns>
   <id>5762361</id>
   <revision>
     <id>579820445</id>
     <parentid>388441671</parentid>
     <timestamp>2013-11-02T02:29:58Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:=: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="43">=<noinclude>

Template:Documentation </noinclude></text>

     <sha1>81y2jvjxw3y0febsqx5xbr4ikdc7nr6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Aligned table</title>
   <ns>10</ns>
   <id>41873333</id>
   <revision>
     <id>594395151</id>
     <timestamp>2014-02-07T17:43:36Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <comment>Created page with '{{#invoke:aligned table|table}}<noinclude> Template:Documentation </noinclude>'</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="73">{{#invoke:aligned table|table}}<noinclude>

Template:Documentation </noinclude></text>

     <sha1>l2pdz6oei6p663pfn0zm3yutmqqy53k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Border-radius</title>
   <ns>10</ns>
   <id>28991697</id>
   <revision>
     <id>579826979</id>
     <parentid>434900096</parentid>
     <timestamp>2013-11-02T03:44:02Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Border-radius: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="240"><includeonly>-moz-border-radius: Del; -webkit-border-radius: Del; border-radius: Del;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>kh0kskeuq5bluwqetzmmevdazb7mon9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Box-shadow</title>
   <ns>10</ns>
   <id>28991946</id>
   <revision>
     <id>579827010</id>
     <parentid>474404116</parentid>
     <timestamp>2013-11-02T03:44:26Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Box-shadow: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="342"><includeonly>-moz-box-shadow: Del 4px 4px #CCC; -webkit-box-shadow: Del 4px 4px #CCC; box-shadow: Del 4px 4px #CCC;</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>3mztbxemo5ei90g8037myayewz9ur2v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Braces</title>
   <ns>10</ns>
   <id>6757881</id>
   <revision>
     <id>622204286</id>
     <parentid>617167287</parentid>
     <timestamp>2014-08-21T14:43:43Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>thinsp simplification</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="585">{{#if:|<code>}}<!--

--><nowiki>{{</nowiki>Del<!-- -->{{#if: |Template:Thinsp{{{2}}}}}<!-- -->{{#if: |Template:Thinsp{{{3}}}}}<!-- -->{{#if: |Template:Thinsp{{{4}}}}}<!-- -->{{#if: |Template:Thinsp{{{5}}}}}<!-- -->{{#if: |Template:Thinsp{{{6}}}}}<!-- -->{{#if: |Template:Thinsp{{{7}}}}}<!-- -->{{#if: |Template:Thinsp{{{8}}}}}<!-- -->{{#if: |Template:Thinsp{{{9}}}}}<!-- --><nowiki>}}</nowiki><!-- -->{{#if:|</code>}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>8tfkvg1uqrtonj73t9qvrm6xzvllzts</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Button</title>
   <ns>10</ns>
   <id>31869235</id>
   <revision>
     <id>574929316</id>
     <parentid>574929154</parentid>
     <timestamp>2013-09-28T22:56:28Z</timestamp>
     <contributor>
       <username>Computer97</username>
       <id>5790212</id>
     </contributor>
     <minor/>
     <comment>whoops</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="450"><span class="nowrap" title="This is not a clickable button; it illustrates the button one should find." style="padding:.2em .6em; border:1px solid; border-color:#AAA #555 #555 #AAA; Template:Border-radius background-color: #F2F2F2; Template:Linear-gradient {{#ifeq:|bold|font-weight: bold;}} ">Del</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tkx5vzf612dxbtcoipd9ipq9d4vblry</sha1>
   </revision>
 </page>
 <page>
   <title>Template:C</title>
   <ns>10</ns>
   <id>3289688</id>
   <revision>
     <id>637017214</id>
     <parentid>637017135</parentid>
     <timestamp>2014-12-07T13:06:13Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>rv with link</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="223">{{#ifeq:Del|icon |Category&nbsp;[[:Category:{{{2}}}|{{{2}}}]] |Del}}<noinclude>Template:Documentation</noinclude></text>
     <sha1>mv11mpfz2rvscvg84r91lzjl3cb1oi6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="81"><div style="clear:Del;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Code</title>
   <ns>10</ns>
   <id>878369</id>
   <revision>
     <id>601948955</id>
     <parentid>579832262</parentid>
     <timestamp>2014-03-30T12:03:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>allow class, id and style, like other shortcut templates.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="258"><code {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}}><syntaxhighlight lang="&quot;text&quot;" enclose="&quot;none&quot;">Del</syntaxhighlight></code><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6vmwscbw65dh5j9cwy7gy6txtfol8pi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc</title>
   <ns>10</ns>
   <id>34596069</id>
   <redirect title="Template:Deprecated code" />
   <revision>
     <id>474887506</id>
     <timestamp>2012-02-04T01:43:01Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>redir</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="38">#REDIRECT Template:Deprecated code</text>
     <sha1>3nk6qkdjqloltzt5k65vfv5ziiuq5gu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Dc2</title>
   <ns>10</ns>
   <id>34603369</id>
   <revision>
     <id>475023228</id>
     <parentid>475020302</parentid>
     <timestamp>2012-02-04T21:31:37Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>some mobile devices, I hear, do not support non-numeric colors.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="429"><del style="color:{{#if:|#B26F5A|#A9A9A9}}; text-decoration:line-through; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}><span style="color:{{#if:|#8B0000|#696969}};">Del</span></del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>hmrbp939i32zqjv2eilrc3zpawx7asw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Deprecated code</title>
   <ns>10</ns>
   <id>34595847</id>
   <revision>
     <id>630217927</id>
     <parentid>630173215</parentid>
     <timestamp>2014-10-19T09:39:43Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>grey was fine</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="358"><del style="color:{{#if:|#8B0000|#808080}}; text-decoration:none; {{#if:|{{{style}}}|}}" {{#if:|id="{{{id}}}|}}" {{#if:|class="{{{class}}}|}}" {{#if:|title="{{{2}}}"|}}>Del</del><noinclude>

Template:Documentation

<!--Categories and interwikis go on the /doc subpage.--> </noinclude></text>

     <sha1>h63kwtoap8wrijhda9579mms39yp3xu</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>615383778</id>
     <parentid>615383581</parentid>
     <timestamp>2014-07-03T04:12:19Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="182">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}<noinclude>

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>617432645</id>
     <parentid>608599904</parentid>
     <timestamp>2014-07-18T09:37:22Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1667"><includeonly><!--
-->{{#ifeq:key press |doc
    | <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->

</includeonly><!--

     -->{{#ifeq:show |show
         | Template:Mbox
        }}<!--
     --><!--
     -->{{#if: |<!--(don't categorize)-->
         |   <includeonly><!--
              -->{{#ifexist:Template:Key press
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}<!--
          --></includeonly>
        }}<!--

(completing initial #ifeq: at start of template:) --><includeonly>

    | <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
   }}<!--

--></includeonly><noinclude>Template:Documentation</noinclude></text>

     <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Em</title>
   <ns>10</ns>
   <id>28990025</id>
   <revision>
     <id>607075154</id>
     <parentid>607010549</parentid>
     <timestamp>2014-05-04T21:05:26Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Em: Highly visible template ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="304"><onlyinclude><em {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Del</em></onlyinclude><noinclude>

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

     <sha1>nqeeouf7znmu6wlq5p6etyssdlcb53n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Kbd</title>
   <ns>10</ns>
   <id>20614243</id>
   <revision>
     <id>532125965</id>
     <parentid>530321953</parentid>
     <timestamp>2013-01-09T05:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Closed TfD</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="493"><kbd {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="background:#EEEEEE; {{#if:| padding-left:0.4em; padding-right:0.4em;| letter-spacing:0.1em; padding-left:0.5em; padding-right:0.4em;}}{{#if:|{{{style}}}}}" {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Del</kbd><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>qpp5j5yylb5kd1372svhe9bcpltn50v</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/core</title>
   <ns>10</ns>
   <id>22102390</id>
   <revision>
     <id>607048803</id>
     <parentid>607011515</parentid>
     <timestamp>2014-05-04T17:29:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>put some aliases back</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="3339"><kbd class="keyboard-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #f9f9f9; Template:Linear-gradient padding: 0.1em 0.3em; font-family: inherit; font-size: 0.85em;">{{#switch:del

| caps lock = Template:Unicode Caps Lock | caps lock = Template:Unicode Caps Lock | shift = Template:Unicode Shift | shift = Template:Unicode Shift | enter = Template:Unicode Enter | enter = Template:Unicode Enter | cmd = Template:Unicode Cmd | cmd | cmd = Template:Unicode Cmd | command = Template:Unicode Command | command | command = Template:Unicode Command | opt = Template:Unicode Opt | opt | opt = Template:Unicode Opt | option = Template:Unicode Option | option key | option | option = Template:Unicode Option | tab = Tab Template:Unicode | tab = Tab Template:Unicode | backspace = ← Backspace | backspace = ← Backspace | win = Template:Unicode Win | win | win = Template:Unicode Win | menu = Template:Unicode Menu | menu = Template:Unicode Menu | up = ↑ | up = | down = ↓ | down = | left = ← | left = | right = → | right = | * | asterisk = <nowiki>*</nowiki> | # | hash = <nowiki>#</nowiki> | # = # | : | colon = <nowiki>:</nowiki> | [[:]] = : | pipe = <nowiki>|</nowiki> | [[|]] = <nowiki>|</nowiki> | ; | semicolon = <nowiki>;</nowiki> | ; = <nowiki>;</nowiki> | equals = <nowiki>=</nowiki>

<!-- Left & right analog sticks --> | l-up | l up = L↑ | l-down | l down = L↓ | l-left | l left = L← | l-right | l right = L→ | l-ne | l ne = L↗ | l-se | l se = L↘ | l-nw | l nw = L↖ | l-sw | l sw = L↙

| r-up | r up = R↑ | r-down | r down = R↓ | r-left | r left = R← | r-right | r right = R→ | r-ne | r ne = R↗ | r-se | r se = R↘ | r-nw | r nw = R↖ | r-sw | r sw = R↙

<!-- PlayStation --> | ps x | ex = Template:Unicode | ps c | circle = Template:Unicode | ps s | square = Template:Unicode | ps t | triangle = Template:Unicode

<!-- Nintendo 64 & GameCube --> | c-up | c up = C↑ | c-down | c down = C↓ | c-left | c left = C← | c-right | c right = C→ | c-ne | c ne = C↗ | c-se | c se = C↘ | c-nw | c nw = C↖ | c-sw | c sw = C↙

<!-- default --> | #default = Del }}</kbd><noinclude>

Template:Documentation <!-- Add categories and interwikis links to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0ea5wy0qb4tcv3krlpva1x1kio03emn</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Key press/doc</title>
   <ns>10</ns>
   <id>14286761</id>
   <revision>
     <id>636916467</id>
     <parentid>625275532</parentid>
     <timestamp>2014-12-06T18:55:58Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>template name update, index, some syntax</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="8673">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE END OF THIS PAGE. -->


This is the Template:Tl template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.

Example

Template:TcTemplate loop detected: Template:Key press

Keystroke combinations

To illustrate keystroke combinations, just use extra parameters:

Template:TcTemplate loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

This template currently handles up to 10 key name parameters, which should be more than enough to accommodate for any possible combination of simultaneous keystrokes. If it gets too many key name parameters it reports the page into Category:Wikipedia keypress template parameter needs fixing. This means we can easily find those pages and fix them, or we can discover if we need to make this template take more parameters.

When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional chain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap:

Template:Tc + Template:Tlc + Template:TlcTemplate loop detected: Template:Key press + Template loop detected: Template:Key press + Template loop detected: Template:Key press
Template:TcTemplate loop detected: Template:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key pressTemplate loop detected: Template:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate loop detected: Template:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

  • Template:TcTemplate loop detected: Template:Key press

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

However, if the characters are marked as wikilinks, they can be entered as such:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Most markup characters also have aliases:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Stick specific diagonals are also supported:

  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
PlayStation
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press
  • Template:TcTemplate loop detected: Template:Key press

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(Del, ); background-image: -o-linear-gradient(Del, ); background-image: -webkit-linear-gradient(Del, ); background-image: linear-gradient(Template:Linear-gradient/legacy, );</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: Del

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = Del }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:|Del}}">{{#if:|{{{2}}}|Del}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:|Del|0.6em}};">Del</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:|font-size:Del;}}">Del</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">Del</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:Del|Del&#61;}}</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:{{{2}}}| |&#124;}}&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:del

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:

|<span style="font-size:Del;"></span> |<span style="font-size:90%;">Del</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Del</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=Del| -{{#invoke:String|len|s={{{2}}}}} |ignore_errors=true}}||yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>Del</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:Template||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:Template||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:pair
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;Del{{#if:|&#32;{{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:Del|!--||&gt;}}...

}}{{#switch:pair

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:Del|!--|--&gt;|&lt;&#47;Del&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Del </div><includeonly>{{#ifeq:Key press|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if:Del |Template:UnicodeDelTemplate:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;Del&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if Del is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:Del;">{{{2}}}</span>]]
| Del

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:Del|Del| tlc&#124;...}}<!--

-->{{#ifeq:x|| &#124;{{{2}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:D|: <!--i.e. if Del's first character is a colon,
             then:--> |Del<!--
             else:--> |{{#switch:
                        |  = Template:{{#if:Del|Del|Key press}}
                        | #default = {{#if:Del|Del|Template:Key press}}
                     }}}}<!--
      -->|<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:Del|Del|{{#ifeq:Template|Template|Key press|Template:Key press}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{2}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{3}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{4}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{5}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{6}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{7}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{8}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{9}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{10}}}}}<!--
-->{{#ifeq:¬|¬ | |&#124;{{{11}}}}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->Del<!--
                         -->{{#if:  |&#124;{{{2}}}}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">Del</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Del</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>Del</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |{{{2}}}<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:Del|linked |{{{2}}}
       | DEL{{#if:|<nowiki>:</nowiki>{{{2}}}}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: Del }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki>

Template:TcTemplate:Key press

On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the numeric keypad):

Template:TcTemplate:TlcTemplate:TlcTemplate:TlcTemplate:Key pressTemplate:Key pressTemplate:Key pressTemplate:Key press

An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:

Template:TcTemplate:Key press

Wikilinks

If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:

If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>Ctrl</nowiki></code> instead of <code><nowiki>Ctrl</nowiki></code>, which leads to a disambiguation page).

Wiki markup characters

Some wiki markup character, like the pipe symbol, the semicolon and the equals sign, need to be entered using the Template:Tl, Template:Tl and Template:Tl templates or as an HTML entity &amp;#124;, &amp;#59;, &amp;#61; respectively:

However, if the characters are marked as wikilinks, they can be entered as such:

Most markup characters also have aliases:

Key symbols

Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others (see also Arrows exception below).

Windows key and Menu key
Old-style Windows key

There are no characters for the Windows key and Menu key. Besides, the Windows logo is trademarked. So this template shows approximate characters for them in the following way:

Video games

Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.

Directional input

The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.

Stick specific diagonals are also supported:

PlayStation

Template:Clear

Technical details

This template calls Template:Tl, which holds the code that otherwise would be repeated several times in Template:Tl, thus simplifying the code.

TemplateData

Template:TemplateDataHeader <templatedata> { "description": "Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.", "params": { "1": { "label": "First key", "description": "First key", "type": "string/line", "required": true }, "2": { "label": "Second key", "description": "Optional key press in combination as the first.", "type": "string/line", "required": false }, "3": { "label": "Third key", "inherits": "2" }, "4": { "label": "Forth key", "inherits": "2" }, "5": { "label": "Fifth key", "inherits": "2" }, "6": { "label": "Sixth key", "inherits": "2" }, "7": { "label": "Seventh key", "inherits": "2" }, "8": { "label": "Eighth key", "inherits": "2" }, "9": { "label": "Ninth key", "inherits": "2" }, "10": { "label": "Tenth key", "inherits": "2" }, "chain": { "label": "Chaining character", "description": "Character between chained key presses", "default": "+", "inherits": "2" }, "chain first": { "description": "Character between first and second key to press", "inherits": "chain" }, "chain second": { "description": "Character between second and third key to press", "inherits": "chain" }, "chain third": { "description": "Character between third and fourth key to press", "inherits": "chain" }, "chain fourth": { "description": "Character between fourth and fifth key to press", "inherits": "chain" } } } </templatedata>

See also


Template:Semantic markup templates

<includeonly> <!-- CATEGORY LINKS BELOW THIS LINE, PLEASE: --> <!-- - Don't add this one; this isn't a graphic template, as it's all done in CSS. -->nl:Sjabloon:Toets sl:Predloga:Keypress </includeonly></text>

     <sha1>ochnjmjdztm9vsniwkyhx8edn01sksq</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient</title>
   <ns>10</ns>
   <id>34343126</id>
   <revision>
     <id>596070016</id>
     <parentid>596069765</parentid>
     <timestamp>2014-02-18T19:15:50Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="406"><includeonly>background-image: -moz-linear-gradient(, ); background-image: -o-linear-gradient(, ); background-image: -webkit-linear-gradient(, ); background-image: linear-gradient(Template:Linear-gradient/legacy, );</includeonly><noinclude>

<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS --> Template:Documentation </noinclude></text>

     <sha1>nh20km1bgbwwpveqvx1yj8gegbhy822</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Linear-gradient/legacy</title>
   <ns>10</ns>
   <id>41981234</id>
   <revision>
     <id>596070233</id>
     <parentid>596070137</parentid>
     <timestamp>2014-02-18T19:17:36Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="283">{{#switch: 

| top = to bottom | bottom = to top | left = to right | right = to left | top left | left top = to bottom right | top right | right top = to bottom left | bottom left | left bottom = to top right | bottom right | right bottom = to top left | #default = {{{1}}} }}</text>

     <sha1>9j78m27xvdl5ku7ikxh82heae7eawtg</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Longitem</title>
   <ns>10</ns>
   <id>38040101</id>
   <revision>
     <id>622374337</id>
     <parentid>603765285</parentid>
     <timestamp>2014-08-22T19:07:18Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>surplus space</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="162"><div style="padding:0.1em 0;line-height:1.2em;{{#if:|{{{1}}}}}">{{#if:|{{{2}}}|{{{1}}}}}</div><noinclude>Template:Documentation</noinclude></text>
     <sha1>49fc4zn9iwtutjzwxa3y1o4o4fb7yng</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lower</title>
   <ns>10</ns>
   <id>8871184</id>
   <revision>
     <id>617176686</id>
     <parentid>385538495</parentid>
     <timestamp>2014-07-16T13:01:24Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="135"><span style="position: relative; top: {{#if:|{{{1}}}|0.6em}};">{{{1}}}</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6tpt2r5c740uplp9d5a3i5mo5ejtdxk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Mono</title>
   <ns>10</ns>
   <id>19121556</id>
   <revision>
     <id>635233992</id>
     <parentid>635233905</parentid>
     <timestamp>2014-11-24T13:14:39Z</timestamp>
     <contributor>
       <username>علیرضا</username>
       <id>20407588</id>
     </contributor>
     <comment>Undid revision 635233905 by علیرضا (talk)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="146"><span style="font-family:monospace,monospace;{{#if:|font-size:{{{1}}};}}">{{{1}}}</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>0z3wijmmjyx9zsd96iybzdgs0w1eiti</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Navbox</title>
   <ns>10</ns>
   <id>995954</id>
   <revision>
     <id>630098073</id>
     <parentid>622579838</parentid>
     <timestamp>2014-10-18T12:29:00Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>linebreaks</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="94"><includeonly>{{#invoke:Navbox|navbox}}</includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tqodcaa2vvhehqaod229udlla0wimek</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nowrap</title>
   <ns>10</ns>
   <id>1627975</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>462345338</id>
     <parentid>217157546</parentid>
     <timestamp>2011-11-25T01:55:12Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>use nowrap class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="120"><span class="nowrap">{{{1}}}</span><noinclude>

Template:Documentation <!--interwikis/categories go inside doc--> </noinclude></text>

     <sha1>17fwdjvz3hltwj2zzd4tt2d1r06wu4k</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>632743510</id>
     <parentid>632739923</parentid>
     <timestamp>2014-11-06T21:17:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Fixing my mistake</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="253"><code class="nowrap" {{#if:|style="background-color:inherit;border:none;"}}>&#124;{{#if:|{{{1}}}&#61;}}</code><noinclude>

Template:Documentation <!--Categories and interwikis go near the bottom of the /doc subpage.--> </noinclude></text>

     <sha1>6nq35qepr5v1d56yqp46kz67w8xqjk3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Param</title>
   <ns>10</ns>
   <id>10360058</id>
   <revision>
     <id>595633342</id>
     <parentid>489019623</parentid>
     <timestamp>2014-02-15T20:41:01Z</timestamp>
     <contributor>
       <username>Technical 13</username>
       <id>14450599</id>
     </contributor>
     <comment>Add a parameter so that if nested=yes, don't bother with <code></code> so that it doesn't break it.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="329">{{#ifeq:Template:Yesno|yes||<code>}}&#123;&#123;&#123;foo</noinclude>{{#ifeq:{{{2}}}| |&#124;}}&#125;&#125;&#125;{{#ifeq:Template:Yesno|yes||</code>}}<noinclude>

Template:Documentation <!--

  PLEASE ADD CATEGORIES AND INTERWIKIS
  TO THE /doc SUBPAGE, THANKS

--> </noinclude></text>

     <sha1>5b048q5t0zwq1is0157affjvvgciesr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:PlayStation key press</title>
   <ns>10</ns>
   <id>18859691</id>
   <revision>
     <id>607913735</id>
     <parentid>475213511</parentid>
     <timestamp>2014-05-10T14:11:13Z</timestamp>
     <contributor>
       <username>Meteor sandwich yum</username>
       <id>19689608</id>
     </contributor>
     <minor/>
     <comment>nn</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="588"><kbd class="playstation-key nowrap" style="border: 1px solid #aaa; Template:Border-radius Template:Box-shadow background-color: #333; padding: 0.1em 0.4em; font-size: 1.25em; font-weight: bold; font-family: inherit; color: {{#switch:lc:x

|o|0|circle = tomato">Template:Unicode |x = lightblue">Template:Unicode |a|t|tr|triangle|∆|△ = lightgreen">Template:Unicode |s|sq|square|□ = pink">Template:Unicode }}</kbd><noinclude> Template:Documentation <!-- Please add this template's categories to the /doc subpage - thanks! --> </noinclude></text>

     <sha1>i9spsmtb6yms5i7h9arwqn4dfsqrv0t</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Pskeypress</title>
   <ns>10</ns>
   <id>27462893</id>
   <redirect title="Template:PlayStation key press" />
   <revision>
     <id>363974332</id>
     <timestamp>2010-05-24T19:06:51Z</timestamp>
     <contributor>
       <username>The Evil IP address</username>
       <id>8337922</id>
     </contributor>
     <comment>moved Template:Pskeypress to Template:PlayStation key press: improve readability</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="44">#REDIRECT Template:PlayStation key press</text>
     <sha1>crtvwbmz6b6dhq5a4qn9c5b4dneqi8y</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Resize</title>
   <ns>10</ns>
   <id>7736359</id>
   <revision>
     <id>634340879</id>
     <parentid>566192308</parentid>
     <timestamp>2014-11-18T06:36:14Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>redundant</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="251">{{#if:

|<span style="font-size:;"></span> |<span style="font-size:90%;">{{{1}}}</span> }}<noinclude> Template:Documentation Template:Resize/TemplateData <!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS--> </noinclude></text>

     <sha1>8vlkuf84dyzx2md9so6zxdwn47bheg6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Samp</title>
   <ns>10</ns>
   <id>32145682</id>
   <revision>
     <id>445071270</id>
     <parentid>445069809</parentid>
     <timestamp>2011-08-16T00:52:13Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>XHTML validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="438"><samp {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} style="padding-left:0.4em; padding-right:0.4em; color:{{#if:|{{{color}}}|#666666}};{{#if:| {{{style}}}|}}" {{{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</samp><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>9yd5dpu19hoeslwecbb9bf61woioh1j</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Semantic markup templates</title>
   <ns>10</ns>
   <id>34556912</id>
   <revision>
     <id>636931457</id>
     <parentid>636931414</parentid>
     <timestamp>2014-12-06T20:57:55Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>typo</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="4064">Template:Navbox<noinclude>Template:Documentation</noinclude></text>
     <sha1>m0gzvu554dt6i218f88tff5qbw2ana2</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Str endswith</title>
   <ns>10</ns>
   <id>22860091</id>
   <revision>
     <id>540585306</id>
     <parentid>540584923</parentid>
     <timestamp>2013-02-26T11:16:40Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>trimming is expected</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="224">{{#ifeq:{{#Invoke:String|sub|s=| -{{#invoke:String|len|s={{{2}}}}} |ignore_errors=true}}||yes}}<noinclude>

Template:Documentation

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

     <sha1>24qim684o7c3kzt5a6cuq3m8p0px7wa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strong</title>
   <ns>10</ns>
   <id>4759494</id>
   <revision>
     <id>607075129</id>
     <parentid>475045756</parentid>
     <timestamp>2014-05-04T21:05:07Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strong ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="285"><strong {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</strong><noinclude>

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

     <sha1>3y4z3yr1isd99vr3vc9m5nja5ofawtt</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Strongbad</title>
   <ns>10</ns>
   <id>33424738</id>
   <revision>
     <id>607075220</id>
     <parentid>475045547</parentid>
     <timestamp>2014-05-04T21:05:53Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Strongbad ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="428">{{#ifeq:NAMESPACE||Template:FormattingError|Template:Strong}}<noinclude>

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

     <sha1>f50zwlt4v5h6sugiy0rjpilg4zps8j3</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Stronggood</title>
   <ns>10</ns>
   <id>33425543</id>
   <revision>
     <id>607557619</id>
     <parentid>607075250</parentid>
     <timestamp>2014-05-08T00:13:29Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <minor/>
     <comment>Removed protection from "Template:Stronggood"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="432">{{#ifeq:NAMESPACE||Template:FormattingError|Template:Strong }}<noinclude>

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

     <sha1>an29klct541qhkk42ihlpncdld1hhpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tag</title>
   <ns>10</ns>
   <id>7252577</id>
   <revision>
     <id>630003983</id>
     <parentid>629994485</parentid>
     <timestamp>2014-10-17T17:15:54Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Improvement on last change</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="531"><code class="nowrap">{{#switch:pair
|c|close  = <!--nothing-->
|s|single
|o|open
|p|pair   = &lt;tag{{#if:|&#32;{{{params}}}}}

}}{{#switch:pair

|c|close  = 
|s|single = &#32;&#47;&gt;
|o|open   = &gt;
|p|pair   = {{#ifeq:tag|!--||&gt;}}...

}}{{#switch:pair

|s|single
|o|open   = <!--nothing-->
|c|close
|p|pair   = {{#ifeq:tag|!--|--&gt;|&lt;&#47;tag&gt;}}

}}</code><noinclude> Template:Documentation </noinclude></text>

     <sha1>3xh5w39towe7d3p3k70z17rrtker5um</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tc</title>
   <ns>10</ns>
   <id>43613171</id>
   <redirect title="Template:Tlc" />
   <revision>
     <id>623171983</id>
     <parentid>622108439</parentid>
     <timestamp>2014-08-28T12:52:39Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>category update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="368">#redirect Template:Tlc

<br/><hr/> ("Tlc" would imply "[T]emplate [l]ink in <[c]ode> font"&nbsp;– except Template:Tlc doesn't (as of August 2014) include a link. Hence this "Tc" redirect.) <!--but not e.g. Category:Internal template-link templates, as this template does not link to a template--></text>

     <sha1>6bgdpqhhav713oedy04hhue3pdxd3t7</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateDataHeader</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>630787660</id>
     <parentid>609283674</parentid>
     <timestamp>2014-10-23T13:09:02Z</timestamp>
     <contributor>
       <username>Hydrargyrum</username>
       <id>291919</id>
     </contributor>
     <minor/>
     <comment>avoid redirect within template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="391"><div class="templatedata-header">{{#if:| |This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

BASEPAGENAME </div><includeonly>{{#ifeq:SUBPAGENAME|sandbox|| }}</includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>hnlnibv2x3scdt65s7k8idwhwbb0ela</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Thinsp</title>
   <ns>10</ns>
   <id>28983734</id>
   <revision>
     <id>617756776</id>
     <parentid>617743703</parentid>
     <timestamp>2014-07-20T21:20:52Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>removed loop</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="154"><includeonly>{{#if: |Template:Unicode{{{1}}}Template:Unicode |Template:Unicode}}</includeonly><noinclude>Template:Documentation</noinclude></text>
     <sha1>lz3td0qpux4k3jsdhk3x3rl3jmzaztx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>622723682</id>
     <parentid>388327745</parentid>
     <timestamp>2014-08-25T10:26:35Z</timestamp>
     <contributor>
       <username>Anomie</username>
       <id>301903</id>
     </contributor>
     <comment>Literal braces to entities, per talk request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="168">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>

Template:Documentation <!-- Categories go on the /doc subpage and interwikis go on Wikidata. --> </noinclude></text>

     <sha1>h0vr3yvr9jdyd17x82vnav21ngwmxuk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlb</title>
   <ns>10</ns>
   <id>25984912</id>
   <revision>
     <id>610784191</id>
     <parentid>609086643</parentid>
     <timestamp>2014-05-30T12:40:04Z</timestamp>
     <contributor>
       <username>Armbrust</username>
       <id>8454797</id>
     </contributor>
     <comment>TfD was closed as no consensus</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="681">Template:Tlg<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gm3otft11z39k88rcclt9chph90nut9</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlbare</title>
   <ns>10</ns>
   <id>43565073</id>
   <revision>
     <id>626313855</id>
     <parentid>621541525</parentid>
     <timestamp>2014-09-20T07:35:34Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>added percentage font-size handling</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="238">{{#if:Template:Str endswith <!--(i.e. if {{{1}}} is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:{{{1}}};">{{{2}}}</span>]]
| [[Template:{{{1}}}|{{{1}}}]]

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>atiz55vvk4gem0tvnnsrtowqye3jkoh</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlc</title>
   <ns>10</ns>
   <id>16451497</id>
   <revision>
     <id>558397105</id>
     <parentid>388762241</parentid>
     <timestamp>2013-06-05T05:05:27Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>class="nowrap"</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="656"><span class="nowrap"><code>&#123;&#123;{{#if:|{{{1}}}| tlc&#124;...}}<!--

-->{{#ifeq:x|| &#124;{{{2}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{3}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{4}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{5}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{6}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{7}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{8}}} | }}<!-- -->{{#ifeq:x|| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>hvz0y5fmfypqrh6hpdtjucpttl59h70</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlg</title>
   <ns>10</ns>
   <id>31734151</id>
   <revision>
     <id>626831738</id>
     <parentid>612112963</parentid>
     <timestamp>2014-09-23T23:55:28Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <comment>Update via sandbox/testcases ("plaincode" option, "boldlink"/"boldname" and "italics" alternatives)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="2613"><includeonly><!--
-->{{#if:        |<span class="nowrap">}}<!--
-->{{#if: |<code> |{{#if:|<code style="border:none;background:transparent;">}} }}<!--
-->{{#if:   | |<nowiki>{{</nowiki>}}<!--
-->{{#if:         |subst:}}<!--
-->{{#if: |}}<!--
-->{{#if: |<!--then omit template link, else:
 -->| {{#if: |<nowiki>{</nowiki>}}<!--
      -->Template:!((:<!--(start building link with "[[:")
                  -->{{#ifeq:padleft:|: <!--i.e. if {{{1}}}'s first character is a colon,
             then:--> |<!--
             else:--> |{{#switch:
                        |  = ns:10:{{#if:||PAGENAME}}
                        | #default = {{#if:||FULLPAGENAME}}
                     }}}}<!--
      -->!<!--(pipe between link and label, i.e. label)
-->}}<!--
-->{{#if: |<nowiki>{</nowiki>}}<!--
label / template name:
-->{{#if:|{{{1}}}|{{#ifeq:NAMESPACE|ns:Template|PAGENAME|FULLPAGENAME}}}}<!--
-->{{#if: |<nowiki>}</nowiki>}}<!--
-->{{#if: | |<!--
      -->Template:!))<!--(end link)
   -->{{#if: |<nowiki>}</nowiki>}}<!-- 
-->}}<!--
-->{{#if: |}}<!--
-->{{#if: |<span style="font-style:italic;">}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#ifeq:¬|¬ | |&#124;#tag:nowiki}}<!--
-->{{#if: |&#124;…}}<!--
-->{{#if: |</span>}}<!--
-->{{#if: | |<nowiki>}}</nowiki>}}<!--
-->{{#if: |</code>}}<!--
-->{{#if: |</span>}}<!--

--></includeonly><noinclude> Template:Documentation </noinclude></text>

     <sha1>qlsacif43o0q8csbzx7xjmx7q1rxggm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>618336566</id>
     <parentid>617735350</parentid>
     <timestamp>2014-07-24T22:37:03Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>force recursive link update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="1051"><includeonly><!--
   --><code><!--
       --><nowiki>{{</nowiki>{{#if: |subst:}}<!--
                    -->[[ns:Template:|]]<!--
                         -->{{#if:  |&#124;{{{2}}}}}<!--
                         -->{{#if:  |&#124;{{{3}}}}}<!--
                         -->{{#if:  |&#124;{{{4}}}}}<!--
                         -->{{#if:  |&#124;{{{5}}}}}<!--
                         -->{{#if:  |&#124;{{{6}}}}}<!--
                         -->{{#if:  |&#124;{{{7}}}}}<!--
                         -->{{#if:  |&#124;{{{8}}}}}<!--
                         -->{{#if:  |&#124;{{{9}}}}}<!--
                         -->{{#if: |&#124;{{{10}}}}}<!--
                         -->{{#if: |&#124;{{{11}}}}}<!--
                         -->{{#if: |&#124;}}<!--
       --><nowiki>}}</nowiki><!--
   --></code><!--

--></includeonly><noinclude> Template:Documentation</noinclude></text>

     <sha1>a2hwnaifnnlfrlgbpqf716bya1xf057</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Unicode</title>
   <ns>10</ns>
   <id>943744</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>566001477</id>
     <parentid>556432245</parentid>
     <timestamp>2013-07-27T09:52:58Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Remove symbol support</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="78"><span class="Unicode">{{{1}}}</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>tsduoskis2ttklbmvmshxa31smqsk9o</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Var</title>
   <ns>10</ns>
   <id>19311880</id>
   <revision>
     <id>445070894</id>
     <parentid>445070227</parentid>
     <timestamp>2011-08-16T00:49:38Z</timestamp>
     <contributor>
       <username>SMcCandlish</username>
       <id>378390</id>
     </contributor>
     <comment>xhtml validity fix</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="345"><var {{#if:|class="{{{class}}}"}} {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7pxpni8exwl8p3m3nfxw4yh4tq7fdtp</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Varserif</title>
   <ns>10</ns>
   <id>19307516</id>
   <revision>
     <id>636931602</id>
     <parentid>588652508</parentid>
     <timestamp>2014-12-06T20:59:01Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use times-serif class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="357"><var class="times-serif {{#if:|{{{class}}}}}" {{#if:|id="{{{id}}}"}} {{#if:|style="{{{style}}}"}} {{#if:|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:|title="{{{title}}}"}}>{{{1}}}</var><noinclude>

<!--Categories and interwikis go near the bottom of the /doc page.--> Template:Documentation </noinclude></text>

     <sha1>7flxnbguonrce9qx9qhtiexy9iea4rk</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Wikivar</title>
   <ns>10</ns>
   <id>9820559</id>
   <revision>
     <id>634312907</id>
     <parentid>618799156</parentid>
     <timestamp>2014-11-18T01:55:51Z</timestamp>
     <contributor>
       <username>Sardanaphalus</username>
       <id>427947</id>
     </contributor>
     <minor/>
     <comment>reduced code indentation</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="339"><includeonly><code><nowiki>{{</nowiki><!--
-->{{#if: |[[WP:VAR|[[:uc:{{{2}}}]]]]<nowiki>:</nowiki>{{{3}}}
    | {{#ifeq:|linked |[[WP:VAR|[[:uc:{{{2}}}]]]]
       | [[:uc:{{{1}}}]]{{#if:|<nowiki>:</nowiki>{{{2}}}}}
   }} }}<!--
--><nowiki>}}</nowiki></code></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>dk2g8q6k9t076u8y8t9v7e6cqwkw1l1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>391649268</id>
     <parentid>388767808</parentid>
     <timestamp>2010-10-19T14:35:06Z</timestamp>
     <contributor>
       <username>Amalthea</username>
       <id>429625</id>
     </contributor>
     <comment>Making this template substable (sorry, job queue): Would be very usable to generalize input to some user talk page templates. Tested.</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="340">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|1        = yes
|#default = yes

}}<noinclude> Template:Documentation </noinclude></text>

     <sha1>38pzczcy3yuch0ep5r1yz593bjppldv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:\</title>
   <ns>10</ns>
   <id>16258728</id>
   <revision>
     <id>464090629</id>
     <parentid>384676626</parentid>
     <timestamp>2011-12-04T20:13:51Z</timestamp>
     <contributor>
       <username>Edokter</username>
       <id>1624037</id>
     </contributor>
     <comment>Use entity</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text xml:space="preserve" bytes="125">&nbsp;/&#32;<noinclude>

Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>gfvlsjgnfxn02vdp58sww0lo44n62ht</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Aligned table</title>
   <ns>828</ns>
   <id>41873595</id>
   <revision>
     <id>624419022</id>
     <parentid>623577319</parentid>
     <timestamp>2014-09-06T14:28:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Aligned table: High-risk Lua module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5035">-- This module implements Template:Aligned table

local p = {}

local function isnotempty(s) return s and s:match( '^%s*(.-)%s*$' ) ~= end

function p.table(frame) local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args local entries = {} local colclass = {} local colstyle = {} local cols = tonumber(args['cols']) or 2

-- create the root table local root = mw.html.create('table')

-- add table style for fullwidth if isnotempty(args['fullwidth']) then root :css('width', '100%') :css('border-collapse', 'collapse') :css('border-spacing', '0px 0px') :css('border', 'none') end

-- add table classes if isnotempty(args['class']) then root:addClass(args['class']) end

-- add table style if isnotempty(args['style']) then root:cssText(args['style']) end

-- build arrays with the column styles and classes if isnotempty(args['leftright']) then colstyle[1] = 'text-align:left;' colstyle[2] = 'text-align:right;' end for i = 1,cols do colclass[ i ] = colclass[ i ] or colstyle[ i ] = colstyle[ i ] or if isnotempty(args['colstyle']) then colstyle[ i ] = args['colstyle'] .. ';' .. colstyle[ i ] end if isnotempty(args['colalign' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['colalign' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'align']) then colstyle[ i ] = 'text-align:' .. args['col' .. tostring(i) .. 'align'] .. ';' .. colstyle[ i ] elseif isnotempty(args['align' .. tostring(i)]) then colstyle[ i ] = 'text-align:' .. args['align' .. tostring(i)] .. ';' .. colstyle[ i ] end if isnotempty(args['colnowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'nowrap']) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] elseif isnotempty(args['nowrap' .. tostring(i)]) then colstyle[ i ] = 'white-space:nowrap;' .. colstyle[ i ] end if isnotempty(args['colwidth' .. tostring(i)]) then colstyle[ i ] = 'width:' .. args['colwidth' .. tostring(i)] .. ';' .. colstyle[ i ] elseif isnotempty(args['col' .. tostring(i) .. 'width']) then colstyle[ i ] = 'width:' .. args['col' .. tostring(i) .. 'width'] .. ';' .. colstyle[ i ] elseif isnotempty(args['colwidth']) then colstyle[ i ] = 'width:' .. args['colwidth'] .. ';' .. colstyle[ i ] end if isnotempty(args['colstyle' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['colstyle' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'style']) then colstyle[ i ] = colstyle[ i ] .. args['col' .. tostring(i) .. 'style'] elseif isnotempty(args['style' .. tostring(i)]) then colstyle[ i ] = colstyle[ i ] .. args['style' .. tostring(i)] end if isnotempty(args['colclass' .. tostring(i)]) then colclass[ i ] = args['colclass' .. tostring(i)] elseif isnotempty(args['col' .. tostring(i) .. 'class']) then colclass[ i ] = args['col' .. tostring(i) .. 'class'] elseif isnotempty(args['class' .. tostring(i)]) then colclass[ i ] = args['class' .. tostring(i)] end end -- compute the maximum cell index local cellcount = 0 for k, v in pairs( args ) do if type( k ) == 'number' then cellcount = math.max(cellcount, k) end end -- compute the number of rows local rows = math.ceil(cellcount / cols)

-- build the table content if isnotempty(args['title']) then local caption = root:tag('caption') caption:cssText(args['titlestyle']) caption:wikitext(args['title']) end if isnotempty(args['above']) then local row = root:tag('tr') local cell = row:tag('th') cell:attr('colspan', cols) cell:cssText(args['abovestyle']) cell:wikitext(args['above']) end for j=1,rows do -- start a new row local row = root:tag('tr') row:css('vertical-align', 'top') -- loop over the cells in each row for i=1,cols do local cell if isnotempty(args['row' .. tostring(j) .. 'header']) then cell = row:tag('th') else cell = row:tag('td') end if args['class' .. tostring(j) .. '.' .. tostring(i)] then cell:addClass(args['class' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowclass' .. tostring(j)] then cell:addClass(args['rowclass' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'class'] then cell:addClass(args['row' .. tostring(j) .. 'class']) end if colclass[i] ~= then cell:addClass(colclass[i]) end end if args['style' .. tostring(j) .. '.' .. tostring(i)] then cell:cssText(args['style' .. tostring(j) .. '.' .. tostring(i)]) else if args['rowstyle' .. tostring(j)] then cell:cssText(args['rowstyle' .. tostring(j)]) elseif args['row' .. tostring(j) .. 'style'] then cell:cssText(args['row' .. tostring(j) .. 'style']) end if isnotempty(colstyle[i]) then cell:cssText(colstyle[i]) end end cell:wikitext(args[cols*(j - 1) + i] or ) end end -- return the root table return tostring(root) end

return p</text>

     <sha1>7ucaz5vp97rqrap7ukhpeeqyn1ay58i</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>615651707</id>
     <parentid>611826022</parentid>
     <timestamp>2014-07-05T03:52:56Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow using both the frame and parent frame arguments with the wrappers option if specifically requested, per protected edit request by User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8620">-- 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

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

--[[ -- 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 type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true 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(iterator, tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, but those values can be -- overwritten. --]] for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = true 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. --]] 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 nilArgs[key] = true else metaArgs[key] = argTableVal return argTableVal end end 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 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] = true else metaArgs[key] = val end end

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

metatable.__ipairs = function () -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end

return args end

return arguments</text>

     <sha1>m9ddo769dkkvlkz48buir34035j4qhc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>617942873</id>
     <parentid>616811662</parentid>
     <timestamp>2014-07-22T05:08:26Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="7871">--------------------------------------------------------------------------------

-- -- -- CATEGORY HANDLER -- -- -- -- This module implements the Template:Category handler template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- --


-- Load required modules local yesno = require('Module:Yesno')

-- Lazily load things we don't always need local mShared, mappings

local p = {}


-- Helper functions


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


-- CategoryHandler class


local CategoryHandler = {} CategoryHandler.__index = CategoryHandler

function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)

-- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle() then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle() obj._usesCurrentTitle = true end end

-- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end

function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end

function CategoryHandler:isSuppressedByArguments() return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative )

-- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end

function CategoryHandler:shouldSkipBlacklistCheck() -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end

function CategoryHandler:matchesBlacklist() if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end

function CategoryHandler:isSuppressed() -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments() or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist() end

function CategoryHandler:getNamespaceParameters() if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end

function CategoryHandler:namespaceParametersExist() -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end

function CategoryHandler:getCategories() local params = self:getNamespaceParameters() local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist() then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end


-- Exports


local p = {}

function p._exportClasses() -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end

function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed() then return nil end return handler:getCategories() end

function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= then return v else return nil end else return v end end }) return p._main(args, data) end

return p</text>

     <sha1>letwavu3yvlayfzew66uuwixmwebq5b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/blacklist</title>
   <ns>828</ns>
   <id>43232926</id>
   <revision>
     <id>616764246</id>
     <parentid>616071213</parentid>
     <timestamp>2014-07-13T09:07:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="732">-- This module contains the blacklist used by Module:Category handler.

-- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested.

return {

   '^Main Page$', -- don't categorise the main page.

   -- Don't categorise the following pages or their subpages.
   -- "%f[/\0]" matches if the next character is "/" or the end of the string.
   '^Wikipedia:Cascade%-protected items%f[/\0]',
   '^User:UBX%f[/\0]', -- The userbox "template" space.
   '^User talk:UBX%f[/\0]',

   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.*$',

   '/[aA]rchive' -- Don't categorise archives.

}</text>

     <sha1>ne8sdldor304iu81gnqa05p401j3exc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/config</title>
   <ns>828</ns>
   <id>42291997</id>
   <revision>
     <id>616764079</id>
     <parentid>616045566</parentid>
     <timestamp>2014-07-13T09:05:36Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="5755">--------------------------------------------------------------------------------

-- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. --


local cfg = {} -- Don't edit this line.


-- Start configuration data --



-- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --


cfg.parameters = {

-- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno() Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno() Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories',

-- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2',

-- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage',

-- The parameter for data to return in all namespaces. all = 'all',

-- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other',

-- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', }


-- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- --


-- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬'

-- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only'


-- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. --


cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }


-- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. --


cfg.wrappers = 'Template:Category handler'


-- End configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>6ga9hbq2pdwalsvx68i53dmbr421rq5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/data</title>
   <ns>828</ns>
   <id>43233647</id>
   <revision>
     <id>616764105</id>
     <parentid>616020360</parentid>
     <timestamp>2014-07-13T09:05:55Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="631">-- This module assembles data to be passed to Module:Category handler using

-- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist.

local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle()

data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist )

data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings() )

return data</text>

     <sha1>k26mwixuaeijisfddb0sxkg82iux8v4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Category handler/shared</title>
   <ns>828</ns>
   <id>43232937</id>
   <revision>
     <id>616764145</id>
     <parentid>616020201</parentid>
     <timestamp>2014-07-13T09:06:15Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="888">-- This module contains shared functions used by Module:Category handler

-- and its submodules.

local p = {}

function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end

function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end

function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end

return p</text>

     <sha1>omlsnhudxz6juptvtxz7ns97jutbzc5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>631812653</id>
     <parentid>627376982</parentid>
     <timestamp>2014-10-30T22:34:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>use mw.html</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="36405">-- This module implements Template:Documentation.

-- 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 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('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end

local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. 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


-- Main function


p.main = makeInvokeFunc('_main')

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-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline() :done() :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' --> '' -- '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 Template:Ombox. 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('87') == -- 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.namespace == mw.site.namespaces.Module.id 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 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 protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.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 editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} 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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('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 = message('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' --> 'Documentation icon' -- '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 = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end

-- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' 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 :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline() :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :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. return '\n' .. (content or ) .. '\n' 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 -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the Template:Fmbox template, courtesy of Module:Message box. --]=]

-- 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 arguments for Template:Fmbox. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;'

-- Assemble the fmbox 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 fmargs.text = text

return messageBox.main('fmbox', fmargs) 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 = message('edit-link-display') local editLink = makeUrlLink(editUrl, editDisplay) local historyUrl = docTitle:fullUrl{action = 'history'} local historyDisplay = message('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 = message('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' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, 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 Template:Documentation 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 -- Template:Documentation 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>05ocn06why89ic143ng489c9qt6zvi4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>627377056</id>
     <parentid>627376301</parentid>
     <timestamp>2014-09-28T05:23:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>remove two deprecated config values</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="18320">----------------------------------------------------------------------------------------------------

-- -- 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 cfg = {} -- Do not edit this line.


-- Protection template configuration


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

--[[


-- 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'] = ''

--[[ -- 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'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page'

--[[ -- 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'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff'

--[[ -- 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'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run'

-- 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'] = 'Documentation icon'

-- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation'

-- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation'

-- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary'

-- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation'

-- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view'

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

-- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history'

-- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge'

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


-- 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'] = 'The above documentation is transcluded from $1.'

--[[ -- 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'] = 'You might want to $1 a documentation page for this Scribunto module.'


-- 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'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."


-- 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'] = 'sandbox'

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

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

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

-- 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'] = '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'] = 'testcases'

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

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


-- 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'] = 'Please add categories to the $1 subpage.'

-- 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'] = '$1.'

--[[ -- 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'] = 'Subpages of this $1'

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

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

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


-- 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'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.'

-- 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-classes'] = 'template-documentation iezoomfix'

-- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = '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'


-- Template:Fmbox template configuration


-- cfg['fmbox-id'] -- The id sent to the "id" parameter of the Template:Fmbox template. cfg['fmbox-id'] = 'documentation-meta-data'

-- cfg['fmbox-style'] -- The value sent to the style parameter of Template:Fmbox. cfg['fmbox-style'] = 'background-color: #ecfcf4'

-- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of Template:Fmbox. cfg['fmbox-textstyle'] = 'font-style: italic'


-- 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>5ji8xq555zsax7grq5tkt5xioninrsd</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>634395963</id>
     <parentid>625761441</parentid>
     <timestamp>2014-11-18T16:42:49Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>fix semi-create-protected pages</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2801">local p = {}

-- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle() end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame():callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not , as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'accountcreator' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'accountcreator' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end

setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end })

return p</text>

     <sha1>r6f6srpwbmh3z9ydb55db3pdf04yt7b</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>611451436</id>
     <parentid>611451330</parentid>
     <timestamp>2014-06-04T00:06:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Undid revision 611451330 by Mr. Stradivarius (talk) whoops, that edit was supposed to be to the sandbox...</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="8343">-- This module provides a library for formatting file wikilinks.

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

local fileLink = {}

function fileLink.new(filename) checkType('fileLink.new', 1, filename, 'string', true) local obj, data = {}, {}

local checkSelf = libraryUtil.makeCheckSelfFunction( 'fileLink', 'fileLink', obj, 'fileLink object' )

-- Set the filename if we were passed it as an input to fileLink.new. if filename then data.theName = filename end

function data:name(s) checkSelf(self, 'name') checkType('fileLink:name', 1, s, 'string') data.theName = s return self end

function data:format(s, filename) checkSelf(self, 'format') checkType('fileLink:format', 1, s, 'string', true) checkType('fileLink:format', 2, format, 'string', true) local validFormats = { thumb = true, thumbnail = true, frame = true, framed = true, frameless = true } if s == nil or validFormats[s] then data.theFormat = s data.theFormatFilename = filename else error(string.format( "bad argument #1 to 'fileLink:format' ('%s' is not a valid format)", s ), 2) end return self end

local function sizeError(methodName) -- Used for formatting duplication errors in size-related methods. error(string.format( "duplicate size argument detected in '%s'" .. " ('upright' cannot be used in conjunction with height or width)", methodName ), 3) end

function data:width(px) checkSelf(self, 'width') checkType('fileLink:width', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:width') end data.theWidth = px return self end

function data:height(px) checkSelf(self, 'height') checkType('fileLink:height', 1, px, 'number', true) if px and data.isUpright then sizeError('fileLink:height') end data.theHeight = px return self end

function data:upright(isUpright, factor) checkSelf(self, 'upright') checkType('fileLink:upright', 1, isUpright, 'boolean', true) checkType('fileLink:upright', 2, factor, 'number', true) if isUpright and (data.theWidth or data.theHeight) then sizeError('fileLink:upright') end data.isUpright = isUpright data.uprightFactor = factor return self end

function data:resetSize() checkSelf(self, 'resetSize') for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do data[field] = nil end return self end

function data:location(s) checkSelf(self, 'location') checkType('fileLink:location', 1, s, 'string', true) local validLocations = { right = true, left = true, center = true, none = true } if s == nil or validLocations[s] then data.theLocation = s else error(string.format( "bad argument #1 to 'fileLink:location' ('%s' is not a valid location)", s ), 2) end return self end

function data:alignment(s) checkSelf(self, 'alignment') checkType('fileLink:alignment', 1, s, 'string', true) local validAlignments = { baseline = true, middle = true, sub = true, super = true, ['text-top'] = true, ['text-bottom'] = true, top = true, bottom = true } if s == nil or validAlignments[s] then data.theAlignment = s else error(string.format( "bad argument #1 to 'fileLink:alignment' ('%s' is not a valid alignment)", s ), 2) end return self end

function data:border(hasBorder) checkSelf(self, 'border') checkType('fileLink:border', 1, hasBorder, 'boolean', true) data.hasBorder = hasBorder return self end

function data:link(s) checkSelf(self, 'link') checkType('fileLink:link', 1, s, 'string', true) data.theLink = s return self end

function data:alt(s) checkSelf(self, 'alt') checkType('fileLink:alt', 1, s, 'string', true) data.theAlt = s return self end

function data:page(num) checkSelf(self, 'page') checkType('fileLink:page', 1, num, 'number', true) data.thePage = s return self end

function data:class(s) checkSelf(self, 'class') checkType('fileLink:class', 1, s, 'string', true) data.theClass = s return self end

function data:lang(s) checkSelf(self, 'lang') checkType('fileLink:lang', 1, s, 'string', true) data.theLang = s return self end

local function checkTypeStringOrNum(funcName, pos, arg) local argType = type(arg) if argType ~= 'nil' and argType ~= 'string' and argType ~= 'number' then error(string.format( "bad argument #%d to '%s' (string or number expected, got %s)", pos, funcName, argType ), 3) end end

function data:startTime(time) checkSelf(self, 'startTime') checkTypeStringOrNum('fileLink:startTime', 1, time) data.theStartTime = time return self end

function data:endTime(time) checkSelf(self, 'endTime') checkTypeStringOrNum('fileLink:endTime', 1, time) data.theEndTime = time return self end

function data:thumbTime(time) checkSelf(self, 'thumbTime') checkTypeStringOrNum('fileLink:thumbTime', 1, time) data.theThumbTime = time return self end

function data:caption(s) checkSelf(self, 'caption') checkType('fileLink:caption', 1, s, 'string', true) data.theCaption = s return self end

function data:render() checkSelf(self, 'render') local ret = {}

-- Filename if not data.theName then error('fileLink:render: no filename was found') end ret[#ret + 1] = 'File:' .. data.theName

-- Format if data.theFormat and data.theFormatFilename then ret[#ret + 1] = data.theFormat .. '=' .. data.theFormatFilename elseif data.theFormat then ret[#ret + 1] = data.theFormat end

-- Border if data.hasBorder then ret[#ret + 1] = 'border' end

-- Location ret[#ret + 1] = data.theLocation

-- Alignment ret[#ret + 1] = data.theAlignment

-- Size if data.isUpright and data.uprightFactor then ret[#ret + 1] = 'upright=' .. tostring(data.uprightFactor) elseif data.isUpright then ret[#ret + 1] = 'upright' elseif data.theWidth and data.theHeight then ret[#ret + 1] = string.format('%dx%dpx', data.theWidth, data.theHeight) elseif data.theWidth then ret[#ret + 1] = tostring(data.theWidth) .. 'px' elseif data.theHeight then ret[#ret + 1] = string.format('x%dpx', data.theHeight) end

-- Render named parameters. -- That includes link, alt, page, class, lang, start, end, and thumbtime. do local namedParameters = { {'link', 'theLink'}, {'alt', 'theAlt'}, {'page', 'thePage'}, {'class', 'theClass'}, {'lang', 'theLang'}, {'start', 'theStartTime'}, {'end', 'theEndTime'}, {'thumbtime', 'theThumbTime'} } for i, t in ipairs(namedParameters) do local parameter = t[1] local value = data[t[2]] if value then ret[#ret + 1] = parameter .. '=' .. tostring(value) end end end

-- Caption ret[#ret + 1] = data.theCaption

return string.format('%s', table.concat(ret, '|')) end

local privateFields = { theName = true, theFormat = true, theFormatFilename = true, theWidth = true, theHeight = true, isUpright = true, uprightFactor = true, theLocation = true, theAlignment = true, hasBorder = true, theLink = true, theAlt = true, thePage = true, theClass = true, theLang = true, theCaption = true }

local readOnlyFields = {} for field in pairs(data) do readOnlyFields[field] = true end readOnlyFields.theName = nil -- This is set if a filename is given to fileLink.new, so remove it.

local function restrictedFieldError(key, restriction) error(string.format( "fileLink object field '%s' is %s", tostring(key), restriction ), 3) end

setmetatable(obj, { __index = function (t, key) if privateFields[key] then restrictedFieldError(key, 'private') else return data[key] end end, __newindex = function (t, key, value) if privateFields[key] then restrictedFieldError(key, 'private') elseif readOnlyFields[key] then restrictedFieldError(key, 'read-only') else data[key] = value end end, __tostring = function (t) return t:render() end, __pairs = function () local temp = {} for k, v in pairs(data) do if not privateFields[k] then temp[k] = v end end return pairs(temp) end })

return obj end

return fileLink</text>

     <sha1>nginalrxy71604mh0leow5l6w0pjeg2</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>635919593</id>
     <parentid>603256010</parentid>
     <timestamp>2014-11-29T17:56:21Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="16506">-- This is a meta-module for producing message box templates, including

-- Template:Mbox, Template:Ambox, Template:Imbox, Template:Tmbox, Template:Ombox, Template:Cmbox and Template:Fmbox.

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

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


-- 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 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 = {}

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.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. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) 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 self.name = args.name 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>(%s)</small>", date) end self.info = args.info 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() -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ 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 textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) 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('Module:Message box/configuration')) 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>8eno95s85119aay9jy5w6tl7a8yzlxx</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>635919831</id>
     <parentid>635432730</parentid>
     <timestamp>2014-11-29T17:58:41Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="6132">--------------------------------------------------------------------------------

-- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. --


return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} },

cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true },

fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false },

imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' },

ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true },

tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>ap6rn0f8a21ktjv9ymkn8pylh7n42ci</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/config</title>
   <ns>828</ns>
   <id>42256703</id>
   <revision>
     <id>602886681</id>
     <parentid>602823531</parentid>
     <timestamp>2014-04-05T17:03:49Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="3545">--------------------------------------------------------------------------------

-- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. --


local cfg = {} -- Don't edit this line.


-- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --



This parameter displays content for the main namespace:

-- cfg.main = 'main'


This parameter displays in talk namespaces:

-- cfg.talk = 'talk'


This parameter displays content for "other" namespaces (namespaces for which
parameters have not been specified):

-- cfg.other = 'other'


This parameter makes talk pages behave as though they are the corresponding
subject namespace. Note that this parameter is used with Module:Yesno.
Edit that module to change the default values of "yes", "no", etc.

-- cfg.subjectns = 'subjectns'


This parameter sets a demonstration namespace:

-- cfg.demospace = 'demospace'


This parameter sets a specific page to compare:

cfg.demopage = 'page'


-- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --



The header for the namespace column in the wikitable containing the list of
possible subject-space parameters.

-- cfg.wikitableNamespaceHeader = 'Namespace'


The header for the wikitable containing the list of possible subject-space
parameters.

-- cfg.wikitableAliasesHeader = 'Aliases'


-- End of configuration data --


return cfg -- Don't edit this line.</text>

     <sha1>1o6ozz56i8q0xgyl6xa41n2v7kelhli</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect/data</title>
   <ns>828</ns>
   <id>42257476</id>
   <revision>
     <id>602886511</id>
     <parentid>602823622</parentid>
     <timestamp>2014-04-05T17:02:16Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>bug fix - use the demospace parameter as both key and value in the argKeys table</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2569">--------------------------------------------------------------------------------

-- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. --


local cfg = require('Module:Namespace detect/config')

local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end

-- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings.

local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' }

local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end

for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end

local function getParamMappings() --[[ -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } --]] local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end

return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings() }</text>

     <sha1>ojp6d3pc8mql5nufaqdg576c9so3479</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>636080316</id>
     <parentid>636074748</parentid>
     <timestamp>2014-11-30T21:51:43Z</timestamp>
     <contributor>
       <username>George Orwell III</username>
       <id>9839650</id>
     </contributor>
     <comment>rem unneeded tabs/spacing for more unified importing/exporting</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="2436">local p = {}

local getArgs

function p._navbar(args) local titleArg = 1

if args.collapsible then titleArg = 2 if not args.plain then args.mini = 1 end if args.fontcolor then args.fontstyle = 'color:' .. args.fontcolor .. ';' end args.style = 'float:left; text-align:left; width:6em;' end

local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local title = mw.title.new(mw.text.trim(titleText), 'Template');

if not title then error('Invalid title ' .. titleText) end

local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ;

local div = mw.html.create():tag('div') div :addClass('plainlinks') :addClass('hlist') :addClass('navbar') :cssText(args.style)

if args.mini then div:addClass('mini') end

if not (args.mini or args.plain) then div :tag('span') :css('word-spacing', 0) :cssText(args.fontstyle) :wikitext(args.text or 'This box:') :wikitext(' ') end

if args.brackets then div :tag('span') :css('margin-right', '-0.125em') :cssText(args.fontstyle) :wikitext('&#91;') :newline(); end

local ul = div:tag('ul');

ul :tag('li') :addClass('nv-view') :wikitext('') :tag('span') :attr('title', 'View this template') :cssText(args.fontstyle) :wikitext(args.mini and 'v' or 'view') :done() :wikitext('') :done() :tag('li') :addClass('nv-talk') :wikitext('') :tag('span') :attr('title', 'Discuss this template') :cssText(args.fontstyle) :wikitext(args.mini and 't' or 'talk') :done() :wikitext('');

if not args.noedit then ul :tag('li') :addClass('nv-edit') :wikitext('[' .. title:fullUrl('action=edit') .. ' ') :tag('span') :attr('title', 'Edit this template') :cssText(args.fontstyle) :wikitext(args.mini and 'e' or 'edit') :done() :wikitext(']'); end

if args.brackets then div :tag('span') :css('margin-left', '-0.125em') :cssText(args.fontstyle) :wikitext('&#93;') :newline(); end

if args.collapsible then div :done() :tag('span') :css('font-size', '110%') :cssText(args.fontstyle) :wikitext(args[1]) end

return tostring(div:done()) end

function p.navbar(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._navbar(getArgs(frame)) end

return p</text>

     <sha1>p4k4w6fpxrech8gjz80ymsvfxebg9dz</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbox</title>
   <ns>828</ns>
   <id>38634746</id>
   <revision>
     <id>636040925</id>
     <parentid>635470792</parentid>
     <timestamp>2014-11-30T16:22:22Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>looks like we really shouldn't have been checking border here at all</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="11640">--

-- This module implements Template:Navbox --

local p = {}

local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized

local args local tableRowAdded = false local border local listnums = {}

local function trim(s)

   return (mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1"))

end

local function addNewline(s)

   if s:match('^[*:;#]') or s:match('^{|') then
       return '\n' .. s ..'\n'
   else
       return s
   end

end

local function addTableRow(tbl)

   -- If any other rows have already been added, then we add a 2px gutter row.
   if tableRowAdded then
       tbl
           :tag('tr')
               :css('height', '2px')
               :tag('td')
                   :attr('colspan',2)
   end
   tableRowAdded = true
   return tbl:tag('tr')

end

local function renderNavBar(titleCell)

   -- Depending on the presence of the navbar and/or show/hide link, we may need to add a spacer div on the left
   -- or right to keep the title centered.
   local spacerSide = nil
   if args.navbar == 'off' then
       -- No navbar, and client wants no spacer, i.e. wants the title to be shifted to the left. If there's
       -- also no show/hide link, then we need a spacer on the right to achieve the left shift.
       if args.state == 'plain' then spacerSide = 'right' end
   elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', ) == 'Template:Navbox') then
       -- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
       if args.state ~= 'plain' then spacerSide = 'left' end
   else
       -- Will render navbar (or error message). If there's no show/hide link, need a spacer on the right
       -- to balance out the width of the navbar.
       if args.state == 'plain' then spacerSide = 'right' end
       titleCell:wikitext(navbar{
           args.name,
           mini = 1,
           fontstyle = (args.basestyle or ) .. ';' .. (args.titlestyle or ) ..  ';background:none transparent;border:none;'
       })
   end
   -- Render the spacer div.
   if spacerSide then
       titleCell
           :tag('span')
               :css('float', spacerSide)
               :css('width', '6em')
               :wikitext('&nbsp;')
   end

end

-- -- Title row -- local function renderTitleRow(tbl)

   if not args.title then return end
   local titleRow = addTableRow(tbl)
   if args.titlegroup then
       titleRow
           :tag('th')
               :attr('scope', 'row')
               :addClass('navbox-group')
               :addClass(args.titlegroupclass)
               :cssText(args.basestyle)
               :cssText(args.groupstyle)
               :cssText(args.titlegroupstyle)
               :wikitext(args.titlegroup)
   end
   local titleCell = titleRow:tag('th'):attr('scope', 'col')
   if args.titlegroup then
       titleCell
           :css('border-left', '2px solid #fdfdfd')
           :css('width', '100%')
   end
   local titleColspan = 2
   if args.imageleft then titleColspan = titleColspan + 1 end
   if args.image then titleColspan = titleColspan + 1 end
   if args.titlegroup then titleColspan = titleColspan - 1 end
   titleCell
       :cssText(args.basestyle)
       :cssText(args.titlestyle)
       :addClass('navbox-title')
       :attr('colspan', titleColspan)
   renderNavBar(titleCell)
   titleCell
        :tag('div')
            :addClass(args.titleclass)
            :css('font-size', '110%')
            :wikitext(addNewline(args.title))

end

-- -- Above/Below rows --

local function getAboveBelowColspan()

   local ret = 2
   if args.imageleft then ret = ret + 1 end
   if args.image then ret = ret + 1 end
   return ret

end

local function renderAboveRow(tbl)

   if not args.above then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.aboveclass)
           :cssText(args.basestyle)
           :cssText(args.abovestyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.above))

end

local function renderBelowRow(tbl)

   if not args.below then return end
   addTableRow(tbl)
       :tag('td')
           :addClass('navbox-abovebelow')
           :addClass(args.belowclass)
           :cssText(args.basestyle)
           :cssText(args.belowstyle)
           :attr('colspan', getAboveBelowColspan())
           :tag('div')
               :wikitext(addNewline(args.below))

end

-- -- List rows -- local function renderListRow(tbl, listnum)

   local row = addTableRow(tbl)
   if listnum == 1 and args.imageleft then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 2px 0px 0px')
               :cssText(args.imageleftstyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.imageleft))
   end
   if args['group' .. listnum] then
       local groupCell = row:tag('th')
       groupCell
           :attr('scope', 'row')
           :addClass('navbox-group')
           :addClass(args.groupclass)
           :cssText(args.basestyle)
       if args.groupwidth then
           groupCell:css('width', args.groupwidth)
       end
       groupCell
           :cssText(args.groupstyle)
           :cssText(args['group' .. listnum .. 'style'])
           :wikitext(args['group' .. listnum])
   end
   local listCell = row:tag('td')
   if args['group' .. listnum] then
       listCell
           :css('text-align', 'left')
           :css('border-left-width', '2px')
           :css('border-left-style', 'solid')
   else
       listCell:attr('colspan', 2)
   end
   if not args.groupwidth then
       listCell:css('width', '100%')
   end
   local isOdd = (listnum % 2) == 1
   local rowstyle = args.evenstyle
   if isOdd then rowstyle = args.oddstyle end
   local evenOdd
   if args.evenodd == 'swap' then
       if isOdd then evenOdd = 'even' else evenOdd = 'odd' end
   else
       if isOdd then evenOdd = args.evenodd or 'odd' else evenOdd = args.evenodd or 'even' end
   end
   listCell
       :css('padding', '0px')
       :cssText(args.liststyle)
       :cssText(rowstyle)
       :cssText(args['list' .. listnum .. 'style'])
       :addClass('navbox-list')
       :addClass('navbox-' .. evenOdd)
       :addClass(args.listclass)
       :tag('div')
           :css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
           :wikitext(addNewline(args['list' .. listnum]))
   if listnum == 1 and args.image then
       row
           :tag('td')
               :addClass('navbox-image')
               :addClass(args.imageclass)
               :css('width', '0%')
               :css('padding', '0px 0px 0px 2px')
               :cssText(args.imagestyle)
               :attr('rowspan', 2 * #listnums - 1)
               :tag('div')
                   :wikitext(addNewline(args.image))
   end

end


-- -- Tracking categories --

local function needsHorizontalLists()

   if border == 'child' or border == 'subgroup'  or args.tracking == 'no' then return false end
   local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent'}
   for i, cls in ipairs(listClasses) do
       if args.listclass == cls or args.bodyclass == cls then
           return false
       end
   end
   return true

end

local function hasBackgroundColors()

   return mw.ustring.match(args.titlestyle or ,'background') or mw.ustring.match(args.groupstyle or ,'background') or mw.ustring.match(args.basestyle or ,'background')

end

local function getTrackingCategories()

   local cats = {}
   if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
   if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
   return cats

end

local function renderTrackingCategories(builder)

   local title = mw.title.getCurrentTitle()
   if title.namespace ~= 10 then return end -- not in template space
   local subpage = title.subpageText
   if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
   for i, cat in ipairs(getTrackingCategories()) do
       builder:wikitext()
   end

end

-- -- Main navbox tables -- local function renderMainTable()

   local tbl = mw.html.create('table')
       :addClass('nowraplinks')
       :addClass(args.bodyclass)
   if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
       tbl
           :addClass('collapsible')
           :addClass(args.state or 'autocollapse')
   end
   tbl:css('border-spacing', 0)
   if border == 'subgroup' or border == 'child' or border == 'none' then
       tbl
           :addClass('navbox-subgroup')
           :cssText(args.bodystyle)
           :cssText(args.style)
   else -- regular navobx - bodystyle and style will be applied to the wrapper table
       tbl
           :addClass('navbox-inner')
           :css('background', 'transparent')
           :css('color', 'inherit')
   end
   tbl:cssText(args.innerstyle)
   renderTitleRow(tbl)
   renderAboveRow(tbl)
   for i, listnum in ipairs(listnums) do
       renderListRow(tbl, listnum)
   end
   renderBelowRow(tbl)
   return tbl

end

function p._navbox(navboxArgs)

   args = navboxArgs
   for k, v in pairs(args) do
       local listnum = ( .. k):match('^list(%d+)$')
       if listnum then table.insert(listnums, tonumber(listnum)) end
   end
   table.sort(listnums)
   border = trim(args.border or args[1] or )
   -- render the main body of the navbox
   local tbl = renderMainTable()
   -- render the appropriate wrapper around the navbox, depending on the border param
   local res = mw.html.create()
   if border == 'none' then
       res:node(tbl)
   elseif border == 'subgroup' or border == 'child' then
       -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
       -- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
       -- padding being applied, and at the end add a <div> to balance out the parent's </div>
       res
           :wikitext('</div>') -- XXX: hack due to lack of unclosed support in mw.html.
           :node(tbl)
           :wikitext('<div>') -- XXX: hack due to lack of unclosed support in mw.html.
   else
       res
           :tag('table')
               :addClass('navbox')
               :css('border-spacing', 0)
               :cssText(args.bodystyle)
               :cssText(args.style)
               :tag('tr')
                   :tag('td')
                       :css('padding', '2px')
                       :node(tbl)
   end
   renderTrackingCategories(res)
   return tostring(res)

end

function p.navbox(frame)

   if not getArgs then
       getArgs = require('Module:Arguments').getArgs
   end
   args = getArgs(frame, {wrappers = 'Template:Navbox'})
   -- Read the arguments in the order they'll be output in, to make references number in the right order.
   local _
   _ = args.title
   _ = args.above
   for i = 1, 20 do
       _ = args["group" .. tostring(i)]
       _ = args["list" .. tostring(i)]
   end
   _ = args.below
   return p._navbox(args)

end

return p</text>

     <sha1>0xz6w9qh3qly5ymbn3g095ijl4yfqxn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>606781024</id>
     <parentid>605595284</parentid>
     <timestamp>2014-05-02T15:35:56Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>rm name exception</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="307">local mt = getmetatable(_G) or {}

function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)</text>

     <sha1>gggsv54pq7f94l3up48hr91qtxnskdm</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>629631175</id>
     <parentid>628035264</parentid>
     <timestamp>2014-10-14T21:48:57Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>add support for the "demolevel" parameter; code by myself and User:Jackmcbarn</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="26206">-- This module implements Template:Pp-meta and its daughter templates such as

-- Template:Pp-dispute, Template:Pp-vandalism and Template:Pp-sock.

-- Initialise necessary modules. require('Module:No globals') local newFileLink = require('Module:File link').new local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno')

-- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang

-- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config'


-- Helper functions


local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage() local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end

local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end

local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end

local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs() since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true }

Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' }

function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle()

-- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end

-- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if obj.level == 'accountcreator' then -- Lump titleblacklisted pages in with template-protected pages, -- since templateeditors can do both. obj.level = 'templateeditor' elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end

-- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end

-- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end

-- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end

-- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end

function Protection:isProtected() return self.level ~= '*' end

function Protection:isTemporary() return type(self.expiry) == 'number' end

function Protection:makeProtectionCategory() local cfg = self._cfg local title = self.title

-- Exit if the page is not protected. if not self:isProtected() then return end

-- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end

-- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end

-- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} }

--[[ -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. --]] if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end

--[[ -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. --]] local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end

--[[ -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. --]] local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return end

function Protection:needsExpiry() local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old Template:Pp-protected didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end

function Protection:isIncorrect() local expiry = self.expiry return not self:isProtected() or type(expiry) == 'number' and expiry < os.time() end

function Protection:isTemplateProtectedNonTemplate() local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end

function Protection:makeCategoryLinks() local msg = self._cfg.msg local ret = { self:makeProtectionCategory() } if self:needsExpiry() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate() then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end


-- Blurb class


local Blurb = {} Blurb.__index = Blurb

Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true }

function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end

-- Private methods --

function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage() local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end

function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end

function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {}

parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter

self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or t[k] = param return param end }) end

msg = msg:gsub('${(%u+)}', self._params) return msg end

function Blurb:_makeCurrentVersionParameter() -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end

function Blurb:_makeEditRequestParameter() local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level

-- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full'

-- Get the display value. local display = self:_getExpandedMessage('edit-request-display')

return mEditRequest._link{type = requestType, display = display} end

function Blurb:_makeExpiryParameter() local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end

function Blurb:_makeExplanationBlurbParameter() -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end

-- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'

-- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end

function Blurb:_makeImageLinkParameter() local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end

function Blurb:_makeIntroBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end

function Blurb:_makeIntroFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end

function Blurb:_makePagetypeParameter() local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end

function Blurb:_makeProtectionBlurbParameter() local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionDateParameter() local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end

function Blurb:_makeProtectionLevelParameter() local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end

function Blurb:_makeProtectionLogParameter() local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end

function Blurb:_makeTalkPageParameter() return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end

function Blurb:_makeTooltipBlurbParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end

function Blurb:_makeTooltipFragmentParameter() if self._protectionObj:isTemporary() then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end

function Blurb:_makeVandalTemplateParameter() return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end

-- Public methods --

function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end

-- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end


-- BannerTemplate class


local BannerTemplate = {} BannerTemplate.__index = BannerTemplate

function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg

-- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason

-- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary() then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end

function BannerTemplate:setImageWidth(width) self._imageWidth = width end

function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end

function BannerTemplate:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return newFileLink(filename) :width(self._imageWidth or 20) :alt(self._imageAlt) :link(self._imageLink) :caption(self._imageCaption) :render() end


-- Banner class


local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner

function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end

function Banner:__tostring() -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage(), text = string.format( "%s%s", reasonText, explanationText and '<br />' .. explanationText or ) } return makeMessageBox('mbox', mbargs) end


-- Padlock class


local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock

function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage()) return tostring(root) end


-- Exports


local p = {}

function p._exportClasses() -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end

function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE)

local protectionObj = Protection.new(args, cfg, title)

local ret = {}

-- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg)

-- Render the banner if protectionObj:isProtected() then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end

-- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks() end

return table.concat(ret) end

function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE)

-- Find default args, if any. local parent = frame.getParent and frame:getParent() local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', )]

-- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs })

-- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end

return p</text>

     <sha1>tv5rch13lvy83akgh9r9h6ett6g720t</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>633561150</id>
     <parentid>633472558</parentid>
     <timestamp>2014-11-12T19:06:56Z</timestamp>
     <contributor>
       <username>Cenarium</username>
       <id>5711305</id>
     </contributor>
     <comment>restoring Mr. Stradivarius' edit since testing is OK and categories are ready</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="43916">-- This module provides configuration data for Module:Protection banner.

return {


-- -- BANNER DATA --


--[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]]

-- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' },

-- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } },

-- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' [[Wikipedia:Biographies of living persons' .. '|biographies of living persons]] policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' [[Wikipedia:Biographies of living persons' .. "|Wikipedia's&nbsp;policy on&nbsp;the&nbsp;biographies" .. ' of&nbsp;living&nbsp;people]].', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Wikipedia:Office actions and the article's ${TALKPAGE}." .. "Do not remove this template from the article until the" .. " restrictions are withdrawn." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end

-- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. '<br /><span style="font-size:90%;">' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate.</span>', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.',

			text = 'This ${PAGETYPE} is currently under the'

.. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice."

return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for edits to a protected page' .. '|request an edit]],' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]],' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]].' } }, autoreview = {} },


-- -- GENERAL DATA TABLES --



-- Protection blurbs


-- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access' .. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered' .. ' users|unregistered]] users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } },



-- Explanation blurbs


-- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]]. You may also [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|request]] that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may [[Wikipedia:Requests for page' .. ' protection#Current requests for edits to a protected page|request an' .. ' edit]] to this page, or [[Wikipedia:Requests for' .. ' page protection#Current requests for reduction in protection level' .. '|ask]] for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Wikipedia:Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]]. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' [[Wikipedia:Requests for page protection' .. '#Current requests for reduction in protection level' .. '|request unprotection]], log in, or' .. ' create an account.' }, } },


-- Protection levels


-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } },


-- Images


-- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } },

-- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true },


-- Image links


-- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } },


-- Padlock positions


-- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' },


-- Protection categories


--[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]]

-- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, },

-- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', },

protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', },


-- Expiry category config


-- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table.

expiryCheckActions = { edit = nil, move = false, autoreview = true },

reasonsWithoutExpiryCheck = { blp = true, template = true, },


-- Pagetypes


-- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },


-- Strings marking indefinite protection


-- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },


-- Group hierarchy


-- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, accountcreator = {'templateeditor'}, autoconfirmed = {'reviewer', 'filemover', 'accountcreator'}, user = {'autoconfirmed'}, ['*'] = {'user'} },


-- Wrapper templates and their default arguments


-- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- {{#invoke:Protection banner|main}} -- -- If other content is desired, it can be added between -- <noinclude>...</noinclude> tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, },


-- -- MESSAGES --


msg = {


-- Intro blurb and intro fragment


-- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',


-- Tooltip blurb


-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',


-- Special explanation blurb


-- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is [[Help:Minor edit#When to mark an edit as a minor edit' .. '|uncontroversial]] or supported by [[Wikipedia:Consensus' .. '|consensus]].',


-- Protection log display values


-- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log',


-- Current version display values


-- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version',


-- Talk page


-- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page',


-- Edit requests


-- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request',


-- Expiry date format


-- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules',


-- Images


-- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>4u1nupyaek5tdfq2secpxnch19w5nzy</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>552254999</id>
     <parentid>540627185</parentid>
     <timestamp>2013-04-26T10:52:01Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>Add "rep" function per request by User:קיפודנחש at Wikipedia:Lua requests#Template:Loop and Template:Loop15. Copied from sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="15731">--[[  

This module is intended to provide access to basic string functions.

Most of the functions provided here can be invoked with named parameters, unnamed parameters, or a mixture. If named parameters are used, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. Depending on the intended use, it may be advantageous to either preserve or remove such whitespace.

Global options

   ignore_errors: If set to 'true' or 1, any error condition will result in 
       an empty string being returned rather than an error message.  
       
   error_category: If an error occurs, specifies the name of a category to 
       include with the error message.  The default category is  
       [Category:Errors reported by Module String].
       
   no_category: If set to 'true' or 1, no category will be added if an error
       is generated.
       

Unit tests for this module are available at Module:String/tests. ]]

local str = {}

--[[ len

This function returns the length of the target string.

Usage: {{#invoke:String|len|target_string|}} OR {{#invoke:String|len|s=target_string}}

Parameters

   s: The string whose length to report

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. ]] function str.len( frame )

   local new_args = str._getParameters( frame.args, {'s'} );
   local s = new_args['s'] or ;
   return mw.ustring.len( s )

end

--[[ sub

This function returns a substring of the target string at specified indices.

Usage: {{#invoke:String|sub|target_string|start_index|end_index}} OR {{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}

Parameters

   s: The string to return a subset of
   i: The fist index of the substring to return, defaults to 1.
   j: The last index of the string to return, defaults to the last character.
   

The first character of the string is assigned an index of 1. If either i or j is a negative value, it is interpreted the same as selecting a character by counting from the end of the string. Hence, a value of -1 is the same as selecting the last character of the string.

If the requested indices are out of range for the given string, an error is reported. ]] function str.sub( frame )

   local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } );
   local s = new_args['s'] or ;
   local i = tonumber( new_args['i'] ) or 1;
   local j = tonumber( new_args['j'] ) or -1;
   
   local len = mw.ustring.len( s );
   -- Convert negatives for range checking
   if i < 0 then
       i = len + i + 1;
   end
   if j < 0 then
       j = len + j + 1;
   end
   
   if i > len or j > len or i < 1 or j < 1 then
       return str._error( 'String subset index out of range' );
   end
   if j < i then
       return str._error( 'String subset indices out of order' );
   end
   
   return mw.ustring.sub( s, i, j )

end

--[[ This function implements that features of Template:Str sub old and is kept in order to maintain these older templates. ]] function str.sublength( frame )

   local i = tonumber( frame.args.i ) or 0
   local len = tonumber( frame.args.len )
   return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )

end

--[[ match

This function returns a substring from the source string that matches a specified pattern.

Usage: {{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}} OR {{#invoke:String|pos|s=source_string|pattern=pattern_string|start=start_index

   |match=match_number|plain=plain_flag|nomatch=nomatch_output}}

Parameters

   s: The string to search
   pattern: The pattern or string to find within the string
   start: The index within the source string to start the search.  The first
       character of the string has index 1.  Defaults to 1.
   match: In some cases it may be possible to make multiple matches on a single 
       string.  This specifies which match to return, where the first match is 
       match= 1.  If a negative number is specified then a match is returned 
       counting from the last match.  Hence match = -1 is the same as requesting
       the last match.  Defaults to 1.
   plain: A flag indicating that the pattern should be understood as plain
       text.  Defaults to false.
   nomatch: If no match is found, output the "nomatch" value rather than an error.

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from each string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

If the match_number or start_index are out of range for the string being queried, then this function generates an error. An error is also generated if no match is found. If one adds the parameter ignore_errors=true, then the error will be suppressed and an empty string will be returned on any failure.

For information on constructing Lua patterns, a form of [regular expression], see:

]] function str.match( frame )

   local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );
   local s = new_args['s'] or ;
   local start = tonumber( new_args['start'] ) or 1;
   local plain_flag = str._getBoolean( new_args['plain'] or false );
   local pattern = new_args['pattern'] or ;
   local match_index = math.floor( tonumber(new_args['match']) or 1 );
   local nomatch = new_args['nomatch'];
   
   if s ==  then
       return str._error( 'Target string is empty' );
   end
   if pattern ==  then
       return str._error( 'Pattern string is empty' );
   end
   if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
       return str._error( 'Requested start is out of range' );
   end
   if match_index == 0 then
       return str._error( 'Match index is out of range' );
   end
   if plain_flag then
       pattern = str._escapePattern( pattern );
   end
   
   local result
   if match_index == 1 then
       -- Find first match is simple case
       result = mw.ustring.match( s, pattern, start )
   else
       if start > 1 then
           s = mw.ustring.sub( s, start );
       end
       
       local iterator = mw.ustring.gmatch(s, pattern);
       if match_index > 0 then
           -- Forward search
           for w in iterator do
               match_index = match_index - 1;
               if match_index == 0 then
                   result = w;
                   break;
               end
           end    
       else
           -- Reverse search
           local result_table = {};
           local count = 1;
           for w in iterator do
               result_table[count] = w;
               count = count + 1;
           end
           
           result = result_table[ count + match_index ];            
       end
   end        
   
   if result == nil then
       if nomatch == nil then
           return str._error( 'Match not found' );
       else
           return nomatch;
       end
   else
       return result;
   end

end

--[[ pos

This function returns a single character from the target string at position pos.

Usage: {{#invoke:String|pos|target_string|index_value}} OR {{#invoke:String|pos|target=target_string|pos=index_value}}

Parameters

   target: The string to search
   pos: The index for the character to return

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the target string. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

The first character has an index value of 1.

If one requests a negative value, this function will select a character by counting backwards from the end of the string. In other words pos = -1 is the same as asking for the last character.

A requested value of zero, or a value greater than the length of the string returns an error. ]] function str.pos( frame )

   local new_args = str._getParameters( frame.args, {'target', 'pos'} );
   local target_str = new_args['target'] or ;
   local pos = tonumber( new_args['pos'] ) or 0;
   if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
       return str._error( 'String index out of range' );
   end    
   
   return mw.ustring.sub( target_str, pos, pos );

end

--[[ str_find

This function duplicates the behavior of Template:Str find, including all of its quirks. This is provided in order to support existing templates, but is NOT RECOMMENDED for new code and templates. New code is recommended to use the "find" function instead.

Returns the first index in "source" that is a match to "target". Indexing is 1-based, and the function returns -1 if the "target" string is not present in "source".

Important Note: If the "target" string is empty / missing, this function returns a value of "1", which is generally unexpected behavior, and must be accounted for separatetly. ]] function str.str_find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target'} );
   local source_str = new_args['source'] or ;
   local target_str = new_args['target'] or ;
   if target_str ==  then
       return 1;
   end    
   
   local start = mw.ustring.find( source_str, target_str, 1, true )
   if start == nil then
       start = -1
   end
   
   return start

end

--[[ find

This function allows one to search for a target string or pattern within another string.

Usage: {{#invoke:String|find|source_str|target_string|start_index|plain_flag}} OR {{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}

Parameters

   source: The string to search
   target: The string or pattern to find within source
   start: The index within the source string to start the search, defaults to 1
   plain: Boolean flag indicating that target should be understood as plain
       text and not as a Lua style regular expression, defaults to true

If invoked using named parameters, Mediawiki will automatically remove any leading or trailing whitespace from the parameter. In some circumstances this is desirable, in other cases one may want to preserve the whitespace.

This function returns the first index >= "start" where "target" can be found within "source". Indices are 1-based. If "target" is not found, then this function returns 0. If either "source" or "target" are missing / empty, this function also returns 0.

This function should be safe for UTF-8 strings. ]] function str.find( frame )

   local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['target'] or ;
   local start_pos = tonumber(new_args['start']) or 1;
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return 0;
   end    
   
   plain = str._getBoolean( plain );
   local start = mw.ustring.find( source_str, pattern, start_pos, plain )
   if start == nil then
       start = 0
   end
   
   return start

end

--[[ replace

This function allows one to replace a target string or pattern within another string.

Usage: {{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}} OR {{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|

  count=replacement_count|plain=plain_flag}}

Parameters

   source: The string to search
   pattern: The string or pattern to find within source
   replace: The replacement text
   count: The number of occurences to replace, defaults to all.
   plain: Boolean flag indicating that pattern should be understood as plain
       text and not as a Lua style regular expression, defaults to true 

]] function str.replace( frame )

   local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } ); 
   local source_str = new_args['source'] or ;
   local pattern = new_args['pattern'] or ;
   local replace = new_args['replace'] or ;
   local count = tonumber( new_args['count'] );
   local plain = new_args['plain'] or true;
       
   if source_str ==  or pattern ==  then
       return source_str;
   end    
   plain = str._getBoolean( plain );
   if plain then
       pattern = str._escapePattern( pattern );
       replace = mw.ustring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
   end
   
   local result;
   if count ~= nil then
       result = mw.ustring.gsub( source_str, pattern, replace, count );
   else
       result = mw.ustring.gsub( source_str, pattern, replace );
   end        
   return result;

end

--[[

   simple function to pipe string.rep to templates.

]]

function str.rep( frame )

   local repetitions = tonumber( frame.args[2] )
   if not repetitions then 
       return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or  ) .. '"' )
   end
   return string.rep( frame.args[1] or , repetitions )

end

--[[ Helper function that populates the argument list given that user may need to use a mix of named and unnamed parameters. This is relevant because named parameters are not identical to unnamed parameters due to string trimming, and when dealing with strings we sometimes want to either preserve or remove that whitespace depending on the application. ]] function str._getParameters( frame_args, arg_list )

   local new_args = {};
   local index = 1;
   local value;
   
   for i,arg in ipairs( arg_list ) do
       value = frame_args[arg]
       if value == nil then
           value = frame_args[index];
           index = index + 1;
       end
       new_args[arg] = value;
   end
   
   return new_args;

end

--[[ Helper function to handle error messages. ]] function str._error( error_str )

   local frame = mw.getCurrentFrame();
   local error_category = frame.args.error_category or 'Errors reported by Module String';
   local ignore_errors = frame.args.ignore_errors or false;
   local no_category = frame.args.no_category or false;
   
   if str._getBoolean(ignore_errors) then
       return ;
   end
   
   local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>';
   if error_category ~=  and not str._getBoolean( no_category ) then
       error_str =  .. error_str;
   end        
   
   return error_str;

end

--[[ Helper Function to interpret boolean strings ]] function str._getBoolean( boolean_str )

   local boolean_value;
   
   if type( boolean_str ) == 'string' then
       boolean_str = boolean_str:lower();
       if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0' 
               or boolean_str ==  then
           boolean_value = false;
       else
           boolean_value = true;
       end    
   elseif type( boolean_str ) == 'boolean' then
       boolean_value = boolean_str;
   else
       error( 'No boolean value found' );
   end    
   return boolean_value

end

--[[ Helper function that escapes all pattern characters so that they will be treated as plain text. ]] function str._escapePattern( pattern_str )

   return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" );

end

return str</text>

     <sha1>l0shz7fzxb1bq626nihqwbptk7dfqd5</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>604718900</id>
     <parentid>582180209</parentid>
     <timestamp>2014-04-18T10:35:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text xml:space="preserve" bytes="678">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno.

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 tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end</text>

     <sha1>ew4l88ll7bbgr20npia5rfyblzqhgyg</sha1>
   </revision>
 </page>

</mediawiki>