Difference between revisions of "Template:Infobox"

From Kronospedia
Jump to navigation Jump to search
Tag: Reverted
Tag: Reverted
Line 59: Line 59:
&lt;/noinclude&gt;</text>
&lt;/noinclude&gt;</text>
       <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
       <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Category link with count</title>
    <ns>10</ns>
    <id>30847816</id>
    <revision>
      <id>1028077630</id>
      <parentid>897610930</parentid>
      <timestamp>2021-06-11T18:13:44Z</timestamp>
      <contributor>
        <username>GKFX</username>
        <id>14918984</id>
      </contributor>
      <comment>Support wider range of (valid) input format</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="360" xml:space="preserve">[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|&lt;!--
--&gt;{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}&lt;!--
--&gt;]]&amp;nbsp;({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})&lt;noinclude&gt;
{{Documentation}}
&lt;/noinclude&gt;</text>
      <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Clc</title>
    <ns>10</ns>
    <id>52342109</id>
    <redirect title="Template:Category link with count" />
    <revision>
      <id>893875624</id>
      <parentid>827250628</parentid>
      <timestamp>2019-04-24T04:30:59Z</timestamp>
      <contributor>
        <username>JJMC89</username>
        <id>24812038</id>
      </contributor>
      <comment>actual template is in the category</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="47" xml:space="preserve">#REDIRECT [[Template:Category link with count]]</text>
      <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Clear</title>
    <ns>10</ns>
    <id>1239772</id>
    <revision>
      <id>684162145</id>
      <parentid>683948339</parentid>
      <timestamp>2015-10-04T23:53:36Z</timestamp>
      <contributor>
        <username>Nyttend</username>
        <id>1960810</id>
      </contributor>
      <minor/>
      <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve">&lt;div style="clear:{{{1|both}}};"&gt;&lt;/div&gt;&lt;noinclude&gt;
{{documentation}}
&lt;/noinclude&gt;</text>
      <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Distinguish</title>
    <ns>10</ns>
    <id>3406012</id>
    <revision>
      <id>828660796</id>
      <parentid>826539975</parentid>
      <timestamp>2018-03-03T23:40:51Z</timestamp>
      <contributor>
        <username>Plastikspork</username>
        <id>5075409</id>
      </contributor>
      <comment>[[Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2]] closed as merge ([[WP:XFDC|XFDcloser]])</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="290" xml:space="preserve">{{#invoke:Distinguish|distinguish}}&lt;noinclude&gt;&lt;!-- splitting these lines causes {{Documentation}} template to terminate green shading when Distinguish is used in /doc pages. --&gt;
{{Documentation}}
&lt;!-- Add categories to the /doc subpage and interwikis to Wikidata, not here! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Div col</title>
    <ns>10</ns>
    <id>12679552</id>
    <revision>
      <id>1006814038</id>
      <parentid>1006811674</parentid>
      <timestamp>2021-02-14T23:20:57Z</timestamp>
      <contributor>
        <username>Matt Fitzpatrick</username>
        <id>291848</id>
      </contributor>
      <comment>whitelist parameter class</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="958" xml:space="preserve">&lt;includeonly&gt;&lt;templatestyles src="Div col/styles.css"/&gt;&lt;!--
--&gt;&lt;div class="div-col {{#ifeq:{{{small|}}}|yes|div-col-small}} {{#ifeq:{{{rules|}}}|yes|div-col-rules}} {{{class|}}}" &lt;!--
--&gt;{{#if:{{{colwidth|}}}{{{gap|}}}{{{style|}}}|&lt;!--
--&gt;style="{{#if:{{{colwidth|}}}|column-width: {{{colwidth}}};}}{{#if:{{{gap|}}}|column-gap: {{{gap}}};}}{{#if:{{{style|}}}|{{{style}}}}}"&lt;!--
--&gt;}}&gt;&lt;!--
--&gt;{{#if:{{{content|}}}|{{{content}}}&lt;/div&gt;}}&lt;!-- Inventory how many pages use small=yes
--&gt;{{#ifeq:{{{small|}}}|yes|[[Category:Pages using div col with small parameter]]}}&lt;!--
--&gt;&lt;/includeonly&gt;{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using div col with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Div col]] with unknown parameter "_VALUE_"; use colwidth= to specify column size |ignoreblank=y | class | colwidth | content | gap | rules | small | style }}&lt;noinclude&gt;
{{Documentation}}
&lt;/noinclude&gt;</text>
      <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Div col/styles.css</title>
    <ns>10</ns>
    <id>66114304</id>
    <revision>
      <id>998391716</id>
      <parentid>994648498</parentid>
      <timestamp>2021-01-05T04:54:19Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>remove the note as not generally necessary</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="488" xml:space="preserve">/* {{pp|small=yes}} */
.div-col {
margin-top: 0.3em;
column-width: 30em;
}
.div-col-small {
font-size: 90%;
}
.div-col-rules {
column-rule: 1px solid #aaa;
}
/* Reset top margin for lists in div col */
.div-col dl,
.div-col ol,
.div-col ul {
margin-top: 0;
}
/* Avoid elements breaking between columns
  See also Template:No col break */
.div-col li,
.div-col dd {
page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */
break-inside: avoid-column;
}</text>
      <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Div col end</title>
    <ns>10</ns>
    <id>12679680</id>
    <revision>
      <id>683947856</id>
      <parentid>627002509</parentid>
      <timestamp>2015-10-03T15:58:07Z</timestamp>
      <contributor>
        <username>NeilN</username>
        <id>409043</id>
      </contributor>
      <minor/>
      <comment>Changed protection level of Template:Div col end: per request at [[WP:RFPP]] ([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 bytes="96" xml:space="preserve">&lt;includeonly&gt;&lt;/div&gt;&lt;/includeonly&gt;&lt;noinclude&gt;
{{Documentation|Template:Div col/doc}}
&lt;/noinclude&gt;</text>
      <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Documentation</title>
    <ns>10</ns>
    <id>13529042</id>
    <revision>
      <id>948472457</id>
      <parentid>948472454</parentid>
      <timestamp>2020-04-01T06:12:34Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>1 revision imported</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="182" xml:space="preserve">{{#invoke:documentation|main|_content={{ {{#invoke:documentation|contentTitle}}}}}}&lt;noinclude&gt;
&lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&gt;
&lt;/noinclude&gt;</text>
      <sha1>o4ddn701tao1ufdnkxe1wdgz5b5ga84</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Documentation subpage</title>
    <ns>10</ns>
    <id>7890381</id>
    <revision>
      <id>948474229</id>
      <parentid>948472460</parentid>
      <timestamp>2020-04-01T06:32:45Z</timestamp>
      <contributor>
        <username>DannyS712</username>
        <id>34581532</id>
      </contributor>
      <comment>Reverted to revision 617432645 by [[Special:Contributions/Sardanaphalus|Sardanaphalus]] ([[User talk:Sardanaphalus|talk]]): Restoring ([[WP:TW|TW]])</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1667" xml:space="preserve">&lt;includeonly&gt;&lt;!--
--&gt;{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}
    | &lt;!--(this template has been transcluded on a /doc or /{{{override}}} page)--&gt;
&lt;/includeonly&gt;&lt;!--
      --&gt;{{#ifeq:{{{doc-notice|show}}} |show
          | {{Mbox
            | type = notice
            | style = margin-bottom:1.0em;
            | image = [[File:Edit-copy green.svg|40px|alt=|link=]]
            | text =
'''This is a [[Wikipedia:Template documentation|documentation]] [[Wikipedia:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}'''.&lt;br /&gt;It contains usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}.
            }}
        }}&lt;!--
      --&gt;{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}&lt;!--
      --&gt;{{#if:{{{inhibit|}}} |&lt;!--(don't categorize)--&gt;
          |  &lt;includeonly&gt;&lt;!--
              --&gt;{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}
                  | [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  | [[Category:Documentation subpages without corresponding pages]]
                  }}&lt;!--
          --&gt;&lt;/includeonly&gt;
        }}&lt;!--
(completing initial #ifeq: at start of template:)
--&gt;&lt;includeonly&gt;
    | &lt;!--(this template has not been transcluded on a /doc or /{{{override}}} page)--&gt;
    }}&lt;!--
--&gt;&lt;/includeonly&gt;&lt;noinclude&gt;{{Documentation}}&lt;/noinclude&gt;</text>
      <sha1>iwoex9r4jjje2jlwm8eygcyef0s6hzx</sha1>
    </revision>
  </page>
  <page>
    <title>Template:High-use</title>
    <ns>10</ns>
    <id>17406187</id>
    <revision>
      <id>1016519090</id>
      <parentid>928975377</parentid>
      <timestamp>2021-04-07T16:19:05Z</timestamp>
      <contributor>
        <username>GKFX</username>
        <id>14918984</id>
      </contributor>
      <comment>Allow system= to be passed through</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="297" xml:space="preserve">{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|all-pages={{{all-pages|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}&lt;noinclude&gt;
{{Documentation}}
&lt;!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Infobox/doc</title>
    <ns>10</ns>
    <id>15383540</id>
    <revision>
      <id>1049450711</id>
      <parentid>1039952971</parentid>
      <timestamp>2021-10-11T22:27:26Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>/* Full blank syntax */ add templatestyles</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="30769" xml:space="preserve">{{distinguish|Template:Userbox}}
{{Documentation subpage}}
&lt;includeonly&gt;{{#ifeq:{{#titleparts:{{PAGENAME}}|1|2}}|old ||{{High-use|3408796|all-pages=yes}}{{Lua|Module:Infobox}}}}&lt;/includeonly&gt;
{{Parameter names example
|name={{PAGENAME}} &lt;!--|child |subbox |decat--&gt; |title |above |subheader |subheader1 |subheader2={{{subheader2}}}&lt;br/&gt;......
|image|caption |image1|caption1 |image2|caption2={{{caption2}}}&lt;br/&gt;......
|header1=&lt;div style="border-top:1px dashed #ccc;"&gt;{{{header1}}}&lt;br/&gt;{{nobold|( ''or'' )}}&lt;/div&gt;
|label2={{{label1}}} |data2={{{data1}}}
|data3=( ''or'' ) |data4=&lt;div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;"&gt;{{{data1}}}&lt;/div&gt;
|header5={{{header2}}}&lt;br/&gt;&lt;div style="padding:0.75em 0 0.5em;"&gt;{{nobold|( ''or'' )}}&lt;/div&gt;
|label6={{{label2}}} |data6={{{data2}}}
|data7=( ''or'' ) |data8=&lt;div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;"&gt;{{{data2}}}&lt;/div&gt;
|data9=&lt;div style="padding:0.75em 0 0.5em;"&gt;( ''etc'' )&lt;/div&gt;
|below
}}
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
== Usage ==
{{tlf|Infobox}} is a meta-template: used to organise an actual &lt;nowiki&gt;{{Infobox sometopic}}&lt;/nowiki&gt; template (like {{tl|Infobox building}}).
For &lt;code&gt;&lt;nowiki&gt;[[Template:Infobox sometopic]]&lt;/nowiki&gt;&lt;/code&gt;, template code then looks like this, simplified:
&lt;pre&gt;
{{Infobox
| name    = {{{name|{{PAGENAME}}}}}
| image    = {{{image|}}}
| caption1 = {{{caption|}}}
| label1  = Former names
|  data1  = {{{former_names|}}}
| header2  = General information
| label3  = Status
|  data3  = {{{status|}}}
... &lt;!-- etc. --&gt;
}}
&lt;/pre&gt;
== Optional control parameters ==
; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value &lt;nowiki&gt;Infobox&lt;/nowiki&gt;; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
; child :  See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
; subbox :  See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".
; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed.  See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details.
== Content parameters ==
=== Title ===
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
; above : Text to put within the uppermost cell of the table.
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
Examples:
{{Infobox
| name = Infobox/doc
| title      = Text in caption over infobox
| subheader  = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| name = Infobox
| title      = Text in caption over infobox
| subheader  = Subheader of the infobox
| header = (the rest of the infobox goes here)
}}
&lt;/pre&gt;{{clear}}
{{Infobox
| name = Infobox/doc
| above      = Text in uppermost cell of infobox
| subheader  = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| name = Infobox
| above      = Text in uppermost cell of infobox
| subheader  = Subheader of the infobox
| subheader2 = Second subheader of the infobox
| header = (the rest of the infobox goes here)
}}
&lt;/pre&gt;{{clear}}
=== Illustration images ===
; image(n) : images to display at the top of the template. Use full image syntax, for example &lt;nowiki&gt;[[File:example.png|200px|alt=Example alt text]]&lt;/nowiki&gt;. Image is centered by default. See [[WP:ALT]] for more on alt text.
; caption(n) : Text to put underneath the images.
=== Main data ===
; header(n) : Text to use as a header in row n.
; label(n) : Text to use as a label in row n.
; data(n) : Text to display as data in row n.
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are:
* {{para|class''(n)''}} {{para|header''(n)''}}
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
==== Number ranges ====
To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:
&lt;pre style="overflow:auto"&gt;
| header3  = Section 1
|  label5  = Label A
|  data5  = Data A
|  label7  = Label C
|  data7  = Data C
| header10 = Section 2
|  label12 = Label D
|  data12 = Data D
&lt;/pre&gt;{{clear}}
It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].
==== Making data fields optional ====
A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:
&lt;pre style="overflow:auto"&gt;
|  label5 = Population
|  data5 = {{{population|}}}
&lt;/pre&gt;{{clear}}
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
&lt;pre style="overflow:auto"&gt;
|  label6 = Mass
|  data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}
&lt;/pre&gt;{{clear}}
For more on #if, see [[meta:ParserFunctions##if:|here]].
==== Hiding headers when all its data fields are empty ====
You can also make headers automatically hide when their section is empty (has no data-row showing).
Consider this situation:
{{Infobox
| title  = Example: header with &amp; without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = Header5 with data below
|  label6 = label6 text |  data6 = Some value
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| title  = Example: header with &amp; without data
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = Header5 with data below
|  label6 = label6 text |  data6 = Some value
}}
&lt;/pre&gt;{{clear}}
If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''':
{{Infobox
| title  = Example: header with &amp; without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = Header5 with data below
|  label6 = label6 text |  data6 = Some value
}}
&lt;syntaxhighlight lang="moin" style="overflow:auto"&gt;
{{Infobox
| title  = Example: header with &amp; without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = Header5 with data below
|  label6 = label6 text |  data6 = Some value
}}
&lt;/syntaxhighlight&gt;{{clear}}
So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.
Note: if the data has empty css elements, like {{para|data|2=&amp;lt;span style="background:yellow;"&gt;&amp;lt;/span&gt;}}, this will be treated as non-empty (having data).
If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items.
{{Infobox
| title  = Example: blank header with &amp; without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = _BLANK_
|  label6 = label6 text |  data6 = Some value, but does not trigger header1 or show header5
}}
&lt;syntaxhighlight lang="moin" style="overflow:auto"&gt;
{{Infobox
| title  = Example: header with &amp; without data
| autoheaders = y
| headerstyle = background:lightgrey
| header1 = Header1 with empty section
|  label2 = label2 text |  data2 =
|  label3 = label3 text |  data3 =
|  label4 = label4 text |  data4 =
| header5 = _BLANK_
|  label6 = label6 text |  data6 = Some value, but does not trigger header1 or show header5
}}
&lt;/syntaxhighlight&gt;{{clear}}
=== Footer ===
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
== Presentation parameters ==
=== Italic titles ===
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the &lt;code&gt;italic title&lt;/code&gt; parameter.
* Turn on italic titles by passing {{para|italic title|&lt;nowiki&gt;{{{italic title|}}}&lt;/nowiki&gt;}} from the infobox.
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|&lt;nowiki&gt;{{{italic title|no}}}&lt;/nowiki&gt;}}
* Do not make any titles italic by not passing the parameter at all.
=== CSS styling ===
{{div col}}
; bodystyle : Applies to the infobox table as a whole
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
; captionstyle : Applies to the text of the image caption.
; rowstyle(n) : This parameter is inserted into the &lt;code&gt;style&lt;/code&gt; attribute for the specified row.
; headerstyle : Applies to all header cells
; subheaderstyle : Applies to all subheader cells
; labelstyle : Applies to all label cells
; datastyle : Applies to all data cells
; belowstyle : Applies only to the below cell
{{div col end}}
=== HTML classes and microformats ===
{{div col}}
; bodyclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the infobox as a whole.
; titleclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the infobox's '''title''' caption.
&lt;!-- currently not implemented in Lua module
; aboverowclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the complete table row the '''above''' cell is on.
--&gt;
; aboveclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the infobox's '''above''' cell.
; subheaderrowclass(n) : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the complete table row the '''subheader''' is on.
; subheaderclass(n) : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the infobox's '''subheader'''.
; imagerowclass(n) : These parameters are inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the complete table row their respective '''image''' is on.
; imageclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the '''image'''.
; rowclass(n) : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the specified row including the '''label''' and '''data''' cells.
; class(n) : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
&lt;!-- currently not implemented in Lua module
; belowrowclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the complete table row the '''below''' cell is on.
--&gt;
; belowclass : This parameter is inserted into the &lt;code&gt;class&lt;/code&gt; attribute for the infobox's '''below''' cell.
{{div col end}}
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
&lt;pre style="overflow:auto"&gt;
| bodyclass = vcard
&lt;/pre&gt;{{clear}}
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
&lt;pre style="overflow:auto"&gt;
| class1 = fn
| class2 = org
| class3 = tel
&lt;/pre&gt;{{clear}}
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
== Examples ==
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
{{Infobox
|name        = Infobox/doc
|bodystyle    =
|titlestyle  =
|abovestyle  = background:#cfc;
|subheaderstyle =
|title        = Test Infobox
|above        = Above text
|subheader    = Subheader above image
|subheader2  = Second subheader
|imagestyle  =
|captionstyle =
|image        = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption      = Caption displayed below File:Example-serious.jpg
|headerstyle  = background:#ccf;
|labelstyle  = background:#ddf;
|datastyle    =
|header1 = Header defined alone
| label1 =
|  data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
|  data2 =
|header3 =
| label3 =
|  data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
|  data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
|  data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below      = Below text
}}
&lt;syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"&gt;
{{Infobox
|name        = Infobox
|bodystyle    =
|titlestyle  =
|abovestyle  = background:#cfc;
|subheaderstyle =
|title        = Test Infobox
|above        = Above text
|subheader    = Subheader above image
|subheader2  = Second subheader
|imagestyle  =
|captionstyle =
|  image      = [[File:Example-serious.jpg|200px|alt=Example alt text]]
|caption      = Caption displayed below Example-serious.jpg
|headerstyle  = background:#ccf;
|labelstyle  = background:#ddf;
|datastyle    =
|header1 = Header defined alone
| label1 =
|  data1 =
|header2 =
| label2 = Label defined alone does not display (needs data, or is suppressed)
|  data2 =
|header3 =
| label3 =
|  data3 = Data defined alone
|header4 = All three defined (header, label, data, all with same number)
| label4 = does not display (same number as a header)
|  data4 = does not display (same number as a header)
|header5 =
| label5 = Label and data defined (label)
|  data5 = Label and data defined (data)
|belowstyle = background:#ddf;
|below      = Below text
}}
&lt;/syntaxhighlight&gt;{{clear}}
For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels:
{{Infobox
|name        = Infobox/doc
|bodystyle  = width:20em
|titlestyle  =
|title      = Test Infobox
|headerstyle =
|labelstyle  = width:33%
|datastyle  =
|header1 =
| label1 = Label 1
|  data1 = Data 1
|header2 =
| label2 = Label 2
|  data2 = Data 2
|header3 =
| label3 = Label 3
|  data3 = Data 3
|header4 = Header 4
| label4 =
|  data4 =
|header5 =
| label5 = Label 5
|  data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
&lt;syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"&gt;
{{Infobox
|name        = Infobox
|bodystyle  = width:20em
|titlestyle  =
|title      = Test Infobox
|headerstyle =
|labelstyle  = width:33%
|datastyle  =
|header1 =
| label1 = Label 1
|  data1 = Data 1
|header2 =
| label2 = Label 2
|  data2 = Data 2
|header3 =
| label3 = Label 3
|  data3 = Data 3
|header4 = Header 4
| label4 =
|  data4 =
|header5 =
| label5 = Label 5
|  data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|belowstyle =
|below = Below text
}}
&lt;/syntaxhighlight&gt;{{clear}}
== Embedding ==
&lt;!--Linked from [[Template:Subinfobox bodystyle/doc]]--&gt;
One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of &lt;code&gt;&lt;nowiki&gt;{{infobox}}&lt;/nowiki&gt;&lt;/code&gt;.
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
  }}
| data2 = {{Infobox | decat = yes | child = yes
  |title = Second subsection
  | label1= Label 2.1
  | data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| title = Top level title
| data1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
  }}
| data2 = {{Infobox | decat = yes | child = yes
  |title = Second subsection
  | label1= Label 2.1
  | data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;/pre&gt;{{clear}}
Note, in the examples above, the child infobox is placed in a &lt;code&gt;data&lt;/code&gt; field, not a &lt;code&gt;header&lt;/code&gt; field.  Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
  }}
| header2 = {{Infobox | decat = yes | child = yes
    | title = Second subsection
    | label1= Label 2.1
    | data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| title = Top level title
| header1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
  }}
| header2 = {{Infobox | decat = yes | child = yes
    | title = Second subsection
    | label1= Label 2.1
    | data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;/pre&gt;{{clear}}
or,
{{Infobox
| title = Top level title
| header1 = First subsection
  {{Infobox | decat = yes | child = yes
    | label1 = Label 1.1
    |  data1 = Data 1.1
  }}
| header2 = Second subsection
  {{Infobox | decat = yes | child = yes
    | label1 = Label 2.1
    |  data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;pre style="overflow:auto"&gt;
{{Infobox
| title = Top level title
| header1 = First subsection
  {{Infobox | decat = yes | child = yes
    | label1 = Label 1.1
    |  data1 = Data 1.1
  }}
| header2 = Second subsection
  {{Infobox | decat = yes | child = yes
    | label1 = Label 2.1
    |  data1 = Data 2.1
  }}
| belowstyle =
| below = Below text
}}
&lt;/pre&gt;{{clear}}
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number.
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.
== Subboxes ==
An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure.  One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle  = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
|  data3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle  = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3    |  data3 = Data 3-3
  }}
|  data4 = {{Infobox | subbox = yes
    | labelstyle  = background-color:#ccc;
    |  label1 = Label 4-1    |  data1 = Data 4-1
  }}
|  label5 = Label 5 |  data5 = Data 5
| header6 = Main 6
}}
&lt;syntaxhighlight lang="sass" style="overflow:auto"&gt;
{{Infobox
| headerstyle = background-color:#eee;
| labelstyle  = background-color:#eee;
| header1 = Main 1
| header2 = Main 2
|  data3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle  = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3    |  data3 = Data 3-3
  }}
|  data4 = {{Infobox | subbox = yes
    | labelstyle  = background-color:#ccc;
    |  label1 = Label 4-1    |  data1 = Data 4-1
  }}
|  label5 = Label 5 |  data5 = Data 5
| header6 = Main 6
}}
&lt;/syntaxhighlight&gt;{{clear}}
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3 |  data3 = Data 3-3
  }}
| content4 = {{Infobox | subbox = yes
    | labelstyle = background-color:#ccc;
    |  label1 = Label 4-1 |  data1 = Data 4-1
  }}
| heading5 = Heading 5
}}
&lt;syntaxhighlight lang="sass" style="overflow:auto"&gt;
{{Sidebar
| navbar = off
| headingstyle = background-color:#eee;
| heading1 = Heading 1
| heading2 = Heading 2
| content3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3 |  data3 = Data 3-3
  }}
| content4 = {{Infobox | subbox = yes
    | labelstyle = background-color:#ccc;
    |  label1 = Label 4-1 |  data1 = Data 4-1
  }}
| heading5 = Heading 5
}}
&lt;/syntaxhighlight&gt;{{clear}}
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
== Controlling line-breaking in embedded bulletless lists ==
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.
== Full blank syntax ==
(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)
&lt;pre style="overflow:auto"&gt;
{{Infobox
| name          = Infobox
| child          = {{{child|}}}
| subbox        = {{{subbox|}}}
| italic title  = {{{italic title|no}}}
| templatestyles =
| child templatestyles =
| grandchild templatestyles =
| bodystyle      =
| titlestyle    =
| abovestyle    =
| subheaderstyle =
| title          =
| above          =
| subheader      =
|  imagestyle  =
| captionstyle  =
|  image        =
| caption        =
|  image2      =
| caption2      =
| headerstyle    =
|  labelstyle    =
|  datastyle    =
| header1  =
|  label1  =
|  data1  =
| header2  =
|  label2  =
|  data2  =
| header3  =
|  label3  =
|  data3  =
| header4  =
|  label4  =
|  data4  =
| header5  =
|  label5  =
|  data5  =
| header6  =
|  label6  =
|  data6  =
| header7  =
|  label7  =
|  data7  =
| header8  =
|  label8  =
|  data8  =
| header9  =
|  label9  =
|  data9  =
| header10 =
|  label10 =
|  data10 =
| header11 =
|  label11 =
|  data11 =
| header12 =
|  label12 =
|  data12 =
| header13 =
|  label13 =
|  data13 =
| header14 =
|  label14 =
|  data14 =
| header15 =
|  label15 =
|  data15 =
| header16 =
|  label16 =
|  data16 =
| header17 =
|  label17 =
|  data17 =
| header18 =
|  label18 =
|  data18 =
| header19 =
|  label19 =
|  data19 =
| header20 =
|  label20 =
|  data20 =
| belowstyle    =
| below          =
}}
&lt;/pre&gt;{{clear}}
{{Help:Infobox/user style}}
== Porting to other MediaWikis ==
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
== TemplateData ==
{{TemplateData header}}
&lt;templatedata&gt;
{
    "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",
"format": "{{_\n| ________________ = _\n}}\n",
"params": {
"title": {
"label": "Title",
"description": "Title displayed above the infobox",
"type": "string",
"suggested": true
}
},
"paramOrder": [
"title"
]
}
&lt;/templatedata&gt;
==See also==
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
* Maintenance categories:
** [[:Category:Articles which use infobox templates with no data rows]] ({{PAGESINCATEGORY:Articles which use infobox templates with no data rows|pages}})
** [[:Category:Pages which use embedded infobox templates with the title parameter]] ({{PAGESINCATEGORY:Pages which use embedded infobox templates with the title parameter|pages}})
&lt;includeonly&gt;{{Sandbox other||
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates that add a tracking category]]
[[Category:Lua-based infobox templates]]
}}&lt;/includeonly&gt;
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}</text>
      <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Lua</title>
    <ns>10</ns>
    <id>38752725</id>
    <revision>
      <id>888711835</id>
      <parentid>886057621</parentid>
      <timestamp>2019-03-20T22:04:45Z</timestamp>
      <contributor>
        <username>RMCD bot</username>
        <id>17216044</id>
      </contributor>
      <comment>Removing notice of move discussion</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="196" xml:space="preserve">&lt;includeonly&gt;{{#invoke:Lua banner|main}}&lt;/includeonly&gt;&lt;noinclude&gt;
{{Lua|Module:Lua banner}}
{{documentation}}
&lt;!-- Categories go on the /doc subpage and interwikis go on Wikidata. --&gt;
&lt;/noinclude&gt;</text>
      <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Main other</title>
    <ns>10</ns>
    <id>17220251</id>
    <revision>
      <id>388689011</id>
      <parentid>334818505</parentid>
      <timestamp>2010-10-04T14:46:48Z</timestamp>
      <contributor>
        <username>WOSlinker</username>
        <id>3138265</id>
      </contributor>
      <comment>remove {{pp-template}}</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="409" xml:space="preserve">{{#switch:
  &lt;!--If no or empty "demospace" parameter then detect namespace--&gt;
  {{#if:{{{demospace|}}}
  | {{lc: {{{demospace}}} }}    &lt;!--Use lower case "demospace"--&gt;
  | {{#ifeq:{{NAMESPACE}}|{{ns:0}}
    | main
    | other
    }}
  }}
| main    = {{{1|}}}
| other
| #default = {{{2|}}}
}}&lt;noinclude&gt;
{{documentation}}
&lt;!-- Add categories and interwikis to the /doc subpage, not here! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Nobold</title>
    <ns>10</ns>
    <id>10981056</id>
    <revision>
      <id>865390504</id>
      <parentid>865336863</parentid>
      <timestamp>2018-10-23T17:15:13Z</timestamp>
      <contributor>
        <username>Frietjes</username>
        <id>13791031</id>
      </contributor>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="192" xml:space="preserve">&lt;templatestyles src="Nobold/styles.css"/&gt;&lt;span class="nobold"&gt;{{{1}}}&lt;/span&gt;&lt;noinclude&gt;
{{documentation}}
&lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --&gt;
&lt;/noinclude&gt;</text>
      <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Nobold/styles.css</title>
    <ns>10</ns>
    <id>58856178</id>
    <revision>
      <id>886047488</id>
      <parentid>885218100</parentid>
      <timestamp>2019-03-03T23:43:41Z</timestamp>
      <contributor>
        <username>Pppery</username>
        <id>28032115</id>
      </contributor>
      <comment>Adding protection template</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="89" xml:space="preserve">/* {{pp-template}} */
/* Styling for Template:Nobold */
.nobold {
font-weight: normal;
}</text>
      <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Para</title>
    <ns>10</ns>
    <id>16639086</id>
    <revision>
      <id>948472476</id>
      <parentid>936054140</parentid>
      <timestamp>2020-04-01T06:12:37Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>1 revision imported</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="584" xml:space="preserve">&lt;code class="nowrap" style="{{SAFESUBST:&lt;noinclude /&gt;#if:{{{plain|}}}|border: none; background-color: inherit;}} {{SAFESUBST:&lt;noinclude /&gt;#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}|color: {{SAFESUBST:&lt;noinclude /&gt;#if:{{{mxt|}}}{{{green|}}}|#006400|{{SAFESUBST:&lt;noinclude /&gt;#if:{{{!mxt|}}}{{{red|}}}|#8B0000|inherit}}}};}} {{SAFESUBST:&lt;noinclude /&gt;#if:{{{style|}}}|{{{style}}}}}"&gt;&amp;#124;{{SAFESUBST:&lt;noinclude /&gt;#if:{{{1|}}}|{{{1}}}&amp;#61;}}{{{2|}}}&lt;/code&gt;&lt;noinclude&gt;
{{Documentation}}
&lt;!--Categories and interwikis go near the bottom of the /doc subpage.--&gt;
&lt;/noinclude&gt;</text>
      <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Parameter names example</title>
    <ns>10</ns>
    <id>43305139</id>
    <revision>
      <id>804536750</id>
      <parentid>623570683</parentid>
      <timestamp>2017-10-09T17:20:51Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>Protected "[[Template:Parameter names example]]": [[WP:High-risk templates|Highly visible template]]; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="256" xml:space="preserve">&lt;includeonly&gt;{{#invoke:Parameter names example|main}}&lt;/includeonly&gt;&lt;noinclude&gt;
{{hatnote|[[Template:Generic template demo]] and [[Template:Pnex]] redirect here.}}&lt;!--(hatnote more noticeable here than within Documentation)--&gt;
{{Documentation}}
&lt;/noinclude&gt;</text>
      <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Sandbox other</title>
    <ns>10</ns>
    <id>48540583</id>
    <revision>
      <id>948779760</id>
      <parentid>929909975</parentid>
      <timestamp>2020-04-03T00:08:09Z</timestamp>
      <contributor>
        <username>Evad37</username>
        <id>16958448</id>
      </contributor>
      <comment>Also match subpage names beginning with "sandbox", per [[Template_talk:Sandbox_other#Template-protected_edit_request_on_28_March_2020|edit request]]</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="260" xml:space="preserve">{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}&lt;!--
--&gt;&lt;noinclude&gt;{{documentation}}&lt;/noinclude&gt;</text>
      <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Sidebar</title>
    <ns>10</ns>
    <id>1960394</id>
    <revision>
      <id>960641546</id>
      <parentid>959179329</parentid>
      <timestamp>2020-06-04T02:43:13Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>TFD closed as keep ([[WP:XFDC|XFDcloser]])</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="68" xml:space="preserve">{{#invoke:Sidebar|sidebar}}&lt;noinclude&gt;
{{documentation}}&lt;/noinclude&gt;</text>
      <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
    </revision>
  </page>
  <page>
    <title>Template:TemplateData header</title>
    <ns>10</ns>
    <id>40047498</id>
    <revision>
      <id>1041322034</id>
      <parentid>1039941938</parentid>
      <timestamp>2021-08-29T21:32:29Z</timestamp>
      <contributor>
        <username>SUM1</username>
        <id>12712128</id>
      </contributor>
      <comment>Added "based" parameter to other transclusion</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1114" xml:space="preserve">&lt;div class="templatedata-header"&gt;{{#if:{{{noheader|}}}|&lt;!--
noheader:
--&gt;{{Template parameter usage|based=y}}|&lt;!--
+header:
--&gt;This is the {{#if:{{{nolink|}}}|&lt;!--
  +header, nolink TD
  --&gt;TemplateData|&lt;!--
  +header,  +link [[TD]]; DEFAULT:
--&gt;[[Wikipedia:TemplateData|TemplateData]]}}&lt;!--
  e.o. #if:nolink; DEFAULT:
--&gt; for this template used by [[mw:Extension:TemplateWizard|TemplateWizard]], [[Wikipedia:VisualEditor|VisualEditor]] and other tools. {{Template parameter usage|based=y}}&lt;!--
  e.o. #if:noheader
--&gt;}}
'''TemplateData for {{{1|{{BASEPAGENAME}}}}}'''
&lt;/div&gt;&lt;includeonly&gt;&lt;!--
check parameters
--&gt;{{#invoke:Check for unknown parameters|check
|unknown={{template other|1=[[Category:Pages using TemplateData header with unknown parameters|_VALUE_]]}}
|template=Template:TemplateData header
|1 |nolink |noheader
|preview=&lt;div class="error" style="font-weight:normal"&gt;Unknown parameter '_VALUE_' in [[Template:TemplateData header]].&lt;/div&gt;
}}&lt;!--
--&gt;{{template other|{{sandbox other||
[[Category:Templates using TemplateData]]
}}}}&lt;/includeonly&gt;&lt;!--
--&gt;&lt;noinclude&gt;{{Documentation}}&lt;/noinclude&gt;</text>
      <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template link</title>
    <ns>10</ns>
    <id>1487430</id>
    <revision>
      <id>1014201710</id>
      <parentid>1012903429</parentid>
      <timestamp>2021-03-25T19:03:22Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>[[Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu]] closed as keep ([[WP:XFDC#4.0.11|XFDcloser]])</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="167" xml:space="preserve">&amp;#123;&amp;#123;[[Template:{{{1}}}|{{{1}}}]]&amp;#125;&amp;#125;&lt;noinclude&gt;{{documentation}}
&lt;!-- Categories go on the /doc subpage and interwikis go on Wikidata. --&gt;
&lt;/noinclude&gt;</text>
      <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template link expanded</title>
    <ns>10</ns>
    <id>4497810</id>
    <revision>
      <id>989852943</id>
      <parentid>989783834</parentid>
      <timestamp>2020-11-21T12:04:41Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>update</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="190" xml:space="preserve">{{#Invoke:Template link general|main|code=on}}&lt;noinclude&gt;
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlx}}
}}
&lt;!-- Add categories to the /doc subpage, not here! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template link with link off</title>
    <ns>10</ns>
    <id>16451586</id>
    <revision>
      <id>989853150</id>
      <parentid>989724556</parentid>
      <timestamp>2020-11-21T12:06:17Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>update</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="231" xml:space="preserve">&lt;includeonly&gt;{{#Invoke:Template link general|main|nowrap=yes|nolink=yes}}&lt;/includeonly&gt;&lt;noinclude&gt;
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlf}}
}}
&lt;!-- Add categories to the /doc subpage, not here! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template other</title>
    <ns>10</ns>
    <id>21418395</id>
    <revision>
      <id>874062289</id>
      <parentid>774731050</parentid>
      <timestamp>2018-12-16T22:06:25Z</timestamp>
      <contributor>
        <username>Amorymeltzer</username>
        <id>141948</id>
      </contributor>
      <minor/>
      <comment>Changed protection level for "[[Template:Template other]]": [[WP:High-risk templates|Highly visible template]]: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="435" xml:space="preserve">{{#switch:
  &lt;!--If no or empty "demospace" parameter then detect namespace--&gt;
  {{#if:{{{demospace|}}}
  | {{lc: {{{demospace}}} }}    &lt;!--Use lower case "demospace"--&gt;
  | {{#ifeq:{{NAMESPACE}}|{{ns:Template}}
    | template
    | other
    }}
  }}
| template = {{{1|}}}
| other
| #default = {{{2|}}}
}}&lt;!--End switch--&gt;&lt;noinclude&gt;
{{documentation}}
&lt;!-- Add categories and interwikis to the /doc subpage, not here! --&gt;
&lt;/noinclude&gt;</text>
      <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template parameter usage</title>
    <ns>10</ns>
    <id>51792646</id>
    <revision>
      <id>1039940506</id>
      <parentid>1039918972</parentid>
      <timestamp>2021-08-21T18:02:56Z</timestamp>
      <contributor>
        <username>SUM1</username>
        <id>12712128</id>
      </contributor>
      <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1438" xml:space="preserve">{{#switch:{{{label|}}}
|=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&amp;template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|C|c}}lick here] to see a monthly parameter usage report for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|this template}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&amp;#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|None|none=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&amp;template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report]{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&amp;#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}
|for|For=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&amp;template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{#ifeq:{{yesno-no|{{{lc}}}}}|no|P|p}}arameter usage report] for {{#if:{{{1|}}}|[[Template:{{ROOTPAGENAME:{{{1|}}}}}]]|[[Template:{{ROOTPAGENAME}}]]}}{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&amp;#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}.
|#default=[https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&amp;template={{Urlencode:{{#if:{{{1|}}}|{{ROOTPAGENAME:{{{1|}}}}}|{{ROOTPAGENAME}}}}}} {{{label|}}}]{{#ifeq:{{yesno-no|{{{based}}}}}|yes|&amp;#32;based on {{#if:{{{1|}}}|its|this}} TemplateData}}
}}&lt;noinclude&gt;
{{documentation}}
&lt;/noinclude&gt;</text>
      <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Tl</title>
    <ns>10</ns>
    <id>66733012</id>
    <redirect title="Template:Template link" />
    <revision>
      <id>1006436965</id>
      <timestamp>2021-02-12T22:03:00Z</timestamp>
      <contributor>
        <username>Anthony Appleyard</username>
        <id>119438</id>
      </contributor>
      <comment>Anthony Appleyard moved page [[Template:Tl]] to [[Template:Template link]]: [[Special:Permalink/1006428669|Requested]] by Buidhe at [[WP:RM/TR]]: RM closed as move</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="83" xml:space="preserve">#REDIRECT [[Template:Template link]]
{{Redirect category shell|
{{R from move}}
}}</text>
      <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Tlf</title>
    <ns>10</ns>
    <id>63645417</id>
    <redirect title="Template:Template link with link off" />
    <revision>
      <id>950726704</id>
      <timestamp>2020-04-13T14:42:57Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>Primefac moved page [[Template:Tlf]] to [[Template:Template link with link off]]: full name to indicate what it does</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="97" xml:space="preserve">#REDIRECT [[Template:Template link with link off]]
{{Redirect category shell|
{{R from move}}
}}</text>
      <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Tlx</title>
    <ns>10</ns>
    <id>65893234</id>
    <redirect title="Template:Template link expanded" />
    <revision>
      <id>989735456</id>
      <timestamp>2020-11-20T18:53:35Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>Primefac moved page [[Template:Tlx]] to [[Template:Template link expanded]] over redirect: expand name, make it more obvious</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="92" xml:space="preserve">#REDIRECT [[Template:Template link expanded]]
{{Redirect category shell|
{{R from move}}
}}</text>
      <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Yesno</title>
    <ns>10</ns>
    <id>22255088</id>
    <revision>
      <id>975364754</id>
      <parentid>821904792</parentid>
      <timestamp>2020-08-28T03:15:17Z</timestamp>
      <contributor>
        <username>Xaosflux</username>
        <id>502540</id>
      </contributor>
      <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="374" xml:space="preserve">{{&lt;includeonly&gt;safesubst:&lt;/includeonly&gt;#switch: {{&lt;includeonly&gt;safesubst:&lt;/includeonly&gt;lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0        = {{{no|&lt;!-- null --&gt;}}}
|        = {{{blank|{{{no|&lt;!-- null --&gt;}}}}}}
|¬        = {{{¬|}}}
|yes
|y
|t
|true
|on
|1        = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}&lt;noinclude&gt;
{{Documentation}}
&lt;/noinclude&gt;</text>
      <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Yesno-no</title>
    <ns>10</ns>
    <id>48375573</id>
    <revision>
      <id>825510157</id>
      <parentid>804450734</parentid>
      <timestamp>2018-02-13T20:27:17Z</timestamp>
      <contributor>
        <username>WOSlinker</username>
        <id>3138265</id>
      </contributor>
      <comment>separate pp-template not needed</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="269" xml:space="preserve">{{safesubst:&lt;noinclude /&gt;yesno|{{{1}}}|yes={{{yes|yes}}}|no={{{no|no}}}|blank={{{blank|no}}}|¬={{{¬|no}}}|def={{{def|no}}}}}&lt;noinclude&gt;
{{Documentation|Template:Yesno/doc}}
&lt;!--Categories go in the doc page referenced above; interwikis go in Wikidata.--&gt;
&lt;/noinclude&gt;</text>
      <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
    </revision>
  </page>
  <page>
    <title>Help:Infobox/user style</title>
    <ns>12</ns>
    <id>49658456</id>
    <revision>
      <id>1049450892</id>
      <parentid>1013355183</parentid>
      <timestamp>2021-10-11T22:29:09Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1966" xml:space="preserve">{{{heading|
==Infoboxes and user style ==
}}}
Users can have [[WP:User style|user CSS]] that hides&lt;!--, moves, or makes collapsible--&gt; any infoboxes in their own browsers.
To hide all infoboxes, add the following to [[Special:MyPage/common.css]] (for all [[WP:Skin|skins]], or [[Special:MyPage/skin.css]] for just the current skin), on a line by itself:
&lt;syntaxhighlight lang="css"&gt;div.mw-parser-output .infobox { display: none; }&lt;/syntaxhighlight&gt;
Alternatively, you can add the following code to [[Special:MyPage/common.js|your common.js]] or into a browser user script that is executed by an extension like [[Greasemonkey]]:
&lt;syntaxhighlight lang="js"&gt;$('.infobox').hide();&lt;/syntaxhighlight&gt;
Be aware that although{{#if:{{{guideline|}}}||, per [[WP:Manual of Style/Infoboxes]],}} all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in {{tlx|Taxobox}}, and the OMIM and other medical database codes of {{tlx|Infobox disease}} are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.&lt;!--
Needs Special:Mypage/common.js options for:
* Making infoboxes collapsible
** Making them auto-collapsed
* Moving infoboxes to bottom of page
--&gt;&lt;noinclude&gt;
{{Documentation|content=
This documentation snippet is transcluded at [[Help:Infobox]], [[Template:Infobox/doc]], [[WP:Customisation#Hiding specific messages]], [[Help:User style]], [[WP:Manual of Style/Infoboxes]], and other places where this information is relevant.
As a template, this snippet takes a {{para|heading}} parameter to replace the level-2 &lt;code&gt;==Infoboxes and user style==&lt;/code&gt; section heading code, as needed. E.g., for a &lt;code&gt;=== ... ===&lt;/code&gt; level-3 heading: &lt;code&gt;&lt;nowiki&gt;heading={{=}}{{=}}{{=}}Infoboxes and user style{{=}}{{=}}{{=}}&lt;/nowiki&gt;&lt;/code&gt;
}}
&lt;/noinclude&gt;</text>
      <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Arguments</title>
    <ns>828</ns>
    <id>41298065</id>
    <revision>
      <id>948472485</id>
      <parentid>948472482</parentid>
      <timestamp>2020-04-01T06:12:40Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>1 revision imported</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments</text>
      <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Check for unknown parameters</title>
    <ns>828</ns>
    <id>42286729</id>
    <revision>
      <id>1033173056</id>
      <parentid>934641291</parentid>
      <timestamp>2021-07-12T02:18:24Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>use preview warning rather than not-hatnote hatnote</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent
-- with a list of arguments, returning a specified result if an argument is
-- not on the list
local p = {}
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
local function isnotempty(s)
return s and s:match('%S')
end
local function clean(text)
-- Return text cleaned for display and truncated if too long.
-- Strip markers are replaced with dummy text representing the original wikitext.
local pos, truncated
local function truncate(text)
if truncated then
return ''
end
if mw.ustring.len(text) &gt; 25 then
truncated = true
text = mw.ustring.sub(text, 1, 25) .. '...'
end
return mw.text.nowiki(text)
end
local parts = {}
for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do
pos = remainder
table.insert(parts, truncate(before) .. '&amp;lt;' .. tag .. '&amp;gt;...&amp;lt;/' .. tag .. '&amp;gt;')
end
table.insert(parts, truncate(text:sub(pos or 1)))
return table.concat(parts)
end
function p._check(args, pargs)
if type(args) ~= "table" or type(pargs) ~= "table" then
-- TODO: error handling
return
end
-- create the list of known args, regular expressions, and the return string
local knownargs = {}
local regexps = {}
for k, v in pairs(args) do
if type(k) == 'number' then
v = trim(v)
knownargs[v] = 1
elseif k:find('^regexp[1-9][0-9]*$') then
table.insert(regexps, '^' .. v .. '$')
end
end
-- loop over the parent args, and make sure they are on the list
local ignoreblank = isnotempty(args['ignoreblank'])
local showblankpos = isnotempty(args['showblankpositional'])
local values = {}
for k, v in pairs(pargs) do
if type(k) == 'string' and knownargs[k] == nil then
local knownflag = false
for _, regexp in ipairs(regexps) do
if mw.ustring.match(k, regexp) then
knownflag = true
break
end
end
if not knownflag and ( not ignoreblank or isnotempty(v) )  then
table.insert(values, clean(k))
end
elseif type(k) == 'number' and
knownargs[tostring(k)] == nil and
( showblankpos or isnotempty(v) )
then
table.insert(values, k .. ' = ' .. clean(v))
end
end
-- add results to the output tables
local res = {}
if #values &gt; 0 then
local unknown_text = args['unknown'] or 'Found _VALUE_, '
if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then
local preview_text = args['preview']
if isnotempty(preview_text) then
preview_text = require('Module:If preview')._warning({preview_text})
elseif preview == nil then
preview_text = unknown_text
end
unknown_text = preview_text
end
for _, v in pairs(values) do
-- Fix odd bug for | = which gets stripped to the empty string and
-- breaks category links
if v == '' then v = ' ' end
-- avoid error with v = 'example%2' ("invalid capture index")
local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v})
table.insert(res, r)
end
end
return table.concat(res)
end
function p.check(frame)
local args = frame.args
local pargs = frame:getParent().args
return p._check(args, pargs)
end
return p</text>
      <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Distinguish</title>
    <ns>828</ns>
    <id>50437969</id>
    <revision>
      <id>833561758</id>
      <parentid>833559553</parentid>
      <timestamp>2018-04-01T10:06:10Z</timestamp>
      <contributor>
        <username>Galobtter</username>
        <id>19502780</id>
      </contributor>
      <comment>fixed with text and selfref</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local mTableTools --initialize lazily
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
function p.distinguish(frame)
mArguments = require('Module:Arguments')
mTableTools = require('Module:TableTools')
local args = mArguments.getArgs(frame)
local selfref = args.selfref
local text = args.text
args = mTableTools.compressSparseArray(args)
return p._distinguish(args, text, selfref)
end
function p._distinguish(args, text, selfref)
checkType("_distinguish", 1, args, 'table')
if #args == 0 and not text then return '' end
local text = string.format(
'Not to be confused with %s.',
text or mHatlist.orList(args, true)
)
hnOptions = {selfref = selfref}
return mHatnote._hatnote(text, hnOptions)
end
return p</text>
      <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Documentation</title>
    <ns>828</ns>
    <id>40256557</id>
    <revision>
      <id>1049491596</id>
      <parentid>1035088965</parentid>
      <timestamp>2021-10-12T04:08:05Z</timestamp>
      <contributor>
        <username>Sdkb</username>
        <id>13006032</id>
      </contributor>
      <comment>Added purge button for uncreated documentation, per [[Template_talk:Documentation#Purge_button_for_just-created_documentation|discussion here]].</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="34969" xml:space="preserve">-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- 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
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return mw.ustring.format('[[%s|%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 &lt; 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return '&lt;span class="' .. message('toolbar-class') .. '"&gt;('
.. table.concat(ret, ' &amp;#124; ') .. ')&lt;/span&gt;'
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
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. 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.
--
-- 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' --&gt; 'sandbox'
-- 'testcases-subpage' --&gt; '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' --&gt; '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' --&gt; 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --&gt; 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-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
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext =  package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
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' --&gt; '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --&gt; 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --&gt; 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --&gt; '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --&gt; '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --&gt; 'sandbox page'
-- 'sandbox-notice-compare-link-display' --&gt; 'diff'
-- 'sandbox-notice-testcases-blurb' --&gt; 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --&gt; 'test cases'
-- 'sandbox-category' --&gt; '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 {{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 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 compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '&lt;br /&gt;' .. 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 .. '&lt;br /&gt;' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(message('sandbox-category'))
-- 'documentation-clear'
return '&lt;div class="' .. message('clear') .. '"&gt;&lt;/div&gt;'
.. require('Module:Message box').main('ombox', omargs)
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' --&gt; 'pp-template'
-- 'protection-template-args' --&gt; {docusage = 'yes'}
local 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.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), 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.
return require('Module:Protection banner')._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 or args[1] 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' --&gt; 'view'
-- 'edit-link-display' --&gt; 'edit'
-- 'history-link-display' --&gt; 'history'
-- 'purge-link-display' --&gt; 'purge'
-- 'file-docpage-preload' --&gt; 'Template:Documentation/preload-filespace'
-- 'module-preload' --&gt; 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --&gt; 'Template:Documentation/preload'
-- 'create-link-display' --&gt; 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
local data = {}
data.title = title
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay = 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][purge] 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('%[', '&amp;#91;') -- Replace square brackets with HTML entities.
s = s:gsub('%]', '&amp;#93;')
return s
end
local ret
local docTitle = data.docTitle
local title = data.title
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
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)
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] [%s]'
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, createLink, purgeLink)
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' --&gt; '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --&gt; 'Template documentation'
-- 'module-namespace-heading' --&gt; 'Module documentation'
-- 'file-namespace-heading' --&gt; 'Summary'
-- 'other-namespaces-heading' --&gt; 'Documentation'
-- 'testcases-create-link-display' --&gt; '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
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
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
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:cssText(data.headingStyleText)
: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
--
--]=]
-- 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 link box.
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 '') .. '&lt;br /&gt;'
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"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
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' --&gt; 'edit'
-- 'history-link-display' --&gt; 'history'
-- 'transcluded-from-blurb' --&gt;
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --&gt; 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --&gt; 'create'
-- 'create-module-doc-blurb' --&gt;
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|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)
.. '&lt;br /&gt;'
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})
.. '&lt;br /&gt;'
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' --&gt; 'sandbox'
-- 'sandbox-edit-link-display' --&gt; 'edit'
-- 'compare-link-display' --&gt; 'diff'
-- 'module-sandbox-preload' --&gt; 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --&gt; 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --&gt; 'create'
-- 'mirror-edit-summary' --&gt; 'Create sandbox version of $1'
-- 'mirror-link-display' --&gt; 'mirror'
-- 'mirror-link-preload' --&gt; 'Template:Documentation/mirror'
-- 'sandbox-link-display' --&gt; 'sandbox'
-- 'testcases-link-display' --&gt; 'testcases'
-- 'testcases-edit-link-display'--&gt; 'edit'
-- 'template-sandbox-preload' --&gt; 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --&gt; 'create'
-- 'testcases-link-display' --&gt; 'testcases'
-- 'testcases-edit-link-display' --&gt; 'edit'
-- 'module-testcases-preload' --&gt; 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --&gt; 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --&gt; 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --&gt; 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
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)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto"  and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
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' --&gt; '/doc'
-- 'add-categories-blurb' --&gt; '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' --&gt; 'template'
-- 'module-pagetype' --&gt; 'module'
-- 'default-pagetype' --&gt; 'page'
-- 'subpages-link-display' --&gt; '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
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{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' --&gt; true
-- 'doc-subpage' --&gt; 'doc'
-- 'testcases-subpage' --&gt; 'testcases'
-- 'strange-usage-category' --&gt; 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Documentation/config</title>
    <ns>828</ns>
    <id>41520829</id>
    <revision>
      <id>1035219602</id>
      <parentid>1033083068</parentid>
      <timestamp>2021-07-24T11:26:43Z</timestamp>
      <contributor>
        <username>Gonnym</username>
        <id>14984434</id>
      </contributor>
      <comment>Removing print config values as the code calling them was removed from the main module [[User:Trialpears]]</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------
--
--                              Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local 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'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- 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'] = '[[Wikipedia:Template test cases|template sandbox]] page'
cfg['sandbox-notice-pagetype-module'] = '[[Wikipedia:Template test cases|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'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 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 [[Wikipedia:Template documentation|documentation]] is [[Wikipedia:Transclusion|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 [[Wikipedia:Lua|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'] | cfg['testcases-run-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'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'testcases'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = 'edit'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = 'run'
-- 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'] = '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'
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[Wikipedia:Village pump (technical)/Archive 117]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Documentation/styles.css</title>
    <ns>828</ns>
    <id>61440006</id>
    <revision>
      <id>989579069</id>
      <parentid>989578481</parentid>
      <timestamp>2020-11-19T20:21:58Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <minor/>
      <comment>Changed protection level for "[[Module:Documentation/styles.css]]": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="716" xml:space="preserve">/* {{pp|small=yes}} */
.documentation,
.documentation-metadata {
border: 1px solid #a2a9b1;
background-color: #ecfcf4;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
    font-style: italic;
    padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}</text>
      <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Effective protection expiry</title>
    <ns>828</ns>
    <id>48785459</id>
    <revision>
      <id>948472505</id>
      <parentid>948472504</parentid>
      <timestamp>2020-04-01T06:12:42Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>1 revision imported</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="1494" xml:space="preserve">local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
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
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p</text>
      <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Effective protection level</title>
    <ns>828</ns>
    <id>41617327</id>
    <revision>
      <id>980896975</id>
      <parentid>948472507</parentid>
      <timestamp>2020-09-29T03:38:47Z</timestamp>
      <contributor>
        <username>Jackmcbarn</username>
        <id>19285809</id>
      </contributor>
      <comment>bring in changes from sandbox</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
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' and action ~= 'undelete' then
error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
if action == 'undelete' then
return 'sysop'
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' 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 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
    </revision>
  </page>
  <page>
    <title>Module:File link</title>
    <ns>828</ns>
    <id>42903140</id>
    <revision>
      <id>948474149</id>
      <parentid>948472509</parentid>
      <timestamp>2020-04-01T06:31:54Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <comment>Undid revision 948472508 by [[Special:Contributions/w&gt;IPad365|w&gt;IPad365]] ([[User talk:w&gt;IPad365|talk]])</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p</text>
      <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Hatnote</title>
    <ns>828</ns>
    <id>42498502</id>
    <revision>
      <id>1033185030</id>
      <parentid>970298780</parentid>
      <timestamp>2021-07-12T04:21:02Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>we templatestyles now</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------
--                              Module:Hatnote                                --
--                                                                            --
-- This module produces hatnote links and links to related articles. It      --
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --
-- helper functions for other Lua hatnote modules.                            --
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
function p.findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. Colons
-- are trimmed from the start of the link by default. To skip colon
-- trimming, set the removeColon parameter to false.
checkType('findNamespaceId', 1, link, 'string')
checkType('findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
local namespace = link:match('^(.-):')
if namespace then
local nsTable = mw.site.namespaces[namespace]
if nsTable then
return nsTable.id
end
end
return 0
end
function p.formatPages(...)
-- Formats a list of pages using formatLink and returns it as an array. Nil
-- values are not allowed.
local pages = {...}
local ret = {}
for i, page in ipairs(pages) do
ret[i] = p._formatLink{link = page}
end
return ret
end
function p.formatPageTables(...)
-- Takes a list of page/display tables and returns it as a list of
-- formatted links. Nil values are not allowed.
local pages = {...}
local links = {}
for i, t in ipairs(pages) do
checkType('formatPageTables', i, t, 'table')
local link = t[1]
local display = t[2]
links[i] = p._formatLink{link = link, display = display}
end
return links
end
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
title = title or mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|help]])'
else
helpText = ''
end
-- Make the category text.
local category
if not title.isTalkPage -- Don't categorise talk pages
and title.namespace ~= 2 -- Don't categorise userspace
and yesno(addTrackingCategory) ~= false -- Allow opting out
then
category = 'Hatnote templates with errors'
category = string.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
category
)
else
category = ''
end
return string.format(
'&lt;strong class="error"&gt;Error: %s%s.&lt;/strong&gt;%s',
msg,
helpText,
category
)
end
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'disambiguation'
return string.format('%s (%s)', page, disambiguator)
end
--------------------------------------------------------------------------------
-- Format link
--
-- Makes a wikilink from the given link and display values. Links are escaped
-- with colons if necessary, and links to sections are detected and displayed
-- with " § " as a separator rather than the standard MediaWiki "#". Used in
-- the {{format link}} template.
--------------------------------------------------------------------------------
function p.formatLink(frame)
-- The formatLink export function, for use in templates.
yesno = require('Module:Yesno')
local args = getArgs(frame)
local link = args[1]
if not link then
return p.makeWikitextError(
'no link specified',
'Template:Format link#Errors',
args.category
)
end
return p._formatLink{
link = link,
display = args[2],
italicizePage = yesno(args.italicizepage),
italicizeSection = yesno(args.italicizesection),
}
end
local function italicize(s)
-- Italicize a string.
return '&lt;i&gt;' .. s .. '&lt;/i&gt;'
end
local function maybeItalicize(s, shouldItalicize)
-- italicize s if s is a string and the shouldItalicize parameter is true.
if s and shouldItalicize then
return italicize(s)
else
return s
end
end
local function parseLink(link)
-- Parse a link and return a table with the link's components.
-- These components are:
-- - link: the link, stripped of any initial colon (always present)
-- - page: the page name (always present)
-- - section: the page name (may be nil)
-- - display: the display text, if manually entered after a pipe (may be nil)
link = removeInitialColon(link)
-- Find whether a faux display value has been added with the {{!}} magic
-- word.
local prePipe, display = link:match('^(.-)|(.*)$')
link = prePipe or link
-- Find the page, if it exists.
-- For links like [[#Bar]], the page will be nil.
local preHash, postHash = link:match('^(.-)#(.*)$')
local page
if not preHash then
-- We have a link like [[Foo]].
page = link
elseif preHash ~= '' then
-- We have a link like [[Foo#Bar]].
page = preHash
end
-- Find the section, if it exists.
local section
if postHash and postHash ~= '' then
section = postHash
end
return {
link = link,
page = page,
section = section,
display = display,
}
end
function p._formatLink(options)
-- The formatLink export function, for use in modules.
checkType('_formatLink', 1, options, 'table')
checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false)
checkTypeForNamedArg(
'_formatLink',
'display',
options.display,
'string',
true
)
checkTypeForNamedArg(
'_formatLink',
'italicizePage',
options.italicizePage,
'boolean',
true
)
checkTypeForNamedArg(
'_formatLink',
'italicizeSection',
options.italicizeSection,
'boolean',
true
)
local parsed = parseLink(options.link)
local display = options.display or parsed.display
-- Deal with the case where we don't have to pipe the link
if not display and not parsed.section and not options.italicizePage then
return string.format('[[:%s]]', parsed.link)
end
-- Find the display text for piped links
if not display then
local page = maybeItalicize(parsed.page, options.italicizePage)
local section = maybeItalicize(parsed.section, options.italicizeSection)
if not page then
display = string.format('§&amp;nbsp;%s', section)
elseif section then
display = string.format('%s §&amp;nbsp;%s', page, section)
else
display = page
end
end
return string.format('[[:%s|%s]]', parsed.link, display)
end
--------------------------------------------------------------------------------
-- Hatnote
--
-- Produces standard hatnote text. Implements the {{hatnote}} template.
--------------------------------------------------------------------------------
function p.hatnote(frame)
local args = getArgs(frame)
local s = args[1]
local options = {}
if not s then
return p.makeWikitextError(
'no text specified',
'Template:Hatnote#Errors',
args.category
)
end
options.extraclasses = args.extraclasses
options.selfref = args.selfref
return p._hatnote(s, options)
end
function p._hatnote(s, options)
checkType('_hatnote', 1, s, 'string')
checkType('_hatnote', 2, options, 'table', true)
options = options or {}
local classes = {'hatnote', 'navigation-not-searchable'}
local extraclasses = options.extraclasses
local selfref = options.selfref
if type(extraclasses) == 'string' then
classes[#classes + 1] = extraclasses
end
if selfref then
classes[#classes + 1] = 'selfref'
end
return string.format(
'%s&lt;div role="note" class="%s"&gt;%s&lt;/div&gt;',
mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }
},
table.concat(classes, ' '),
s
)
end
return p</text>
      <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Hatnote/styles.css</title>
    <ns>828</ns>
    <id>61325919</id>
    <revision>
      <id>1033289096</id>
      <parentid>1033184688</parentid>
      <timestamp>2021-07-12T19:22:27Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>per my talk page</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="415" xml:space="preserve">/* {{pp|small=y}} */
.hatnote {
font-style: italic;
}
/* Limit structure CSS to divs because of [[Module:Hatnote inline]] */
div.hatnote {
/* @noflip */
padding-left: 1.6em;
margin-bottom: 0.5em;
}
.hatnote i {
font-style: normal;
}
/* The templatestyles element inserts a link element before hatnotes.
* TODO: Remove link if/when WMF resolves T200206 */
.hatnote + link + .hatnote {
margin-top: -0.5em;
}</text>
      <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Hatnote list</title>
    <ns>828</ns>
    <id>50085079</id>
    <revision>
      <id>962885277</id>
      <parentid>962884504</parentid>
      <timestamp>2020-06-16T15:02:40Z</timestamp>
      <contributor>
        <username>Mr. Stradivarius</username>
        <id>4708675</id>
      </contributor>
      <comment>switch back to [[Module:Hatnote]] instead of [[Module:Hatnote/sandbox]]</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------
--                          Module:Hatnote list                              --
--                                                                            --
-- This module produces and formats lists for use in hatnotes. In particular, --
-- it implements the for-see list, i.e. lists of "For X, see Y" statements,  --
-- as used in {{about}}, {{redirect}}, and their variants. Also introduced    --
-- are andList &amp; orList helpers for formatting lists with those conjunctions. --
--------------------------------------------------------------------------------
local mArguments --initialize lazily
local mHatnote = require('Module:Hatnote')
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
--------------------------------------------------------------------------------
-- List stringification helper functions
--
-- These functions are used for stringifying lists, usually page lists inside
-- the "Y" portion of "For X, see Y" for-see items.
--------------------------------------------------------------------------------
--default options table used across the list stringification functions
local stringifyListDefaultOptions = {
conjunction = "and",
separator = ",",
altSeparator = ";",
space = " ",
formatted = false
}
-- Stringifies a list generically; probably shouldn't be used directly
function stringifyList(list, options)
-- Type-checks, defaults, and a shortcut
checkType("stringifyList", 1, list, "table")
if #list == 0 then return nil end
checkType("stringifyList", 2, options, "table", true)
options = options or {}
for k, v in pairs(stringifyListDefaultOptions) do
if options[k] == nil then options[k] = v end
end
local s = options.space
-- Format the list if requested
if options.formatted then list = mHatnote.formatPages(unpack(list)) end
-- Set the separator; if any item contains it, use the alternate separator
local separator = options.separator
--searches display text only
local function searchDisp(t, f)
return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f)
end
for k, v in pairs(list) do
if searchDisp(v, separator) then
separator = options.altSeparator
break
end
end
-- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§"
local conjunction = s .. options.conjunction .. s
if #list == 2 and searchDisp(list[1], "§") or #list &gt; 2 then
conjunction = separator .. conjunction
end
-- Return the formatted string
return mw.text.listToText(list, separator .. s, conjunction)
end
--DRY function
function conjList (conj, list, fmt)
return stringifyList(list, {conjunction = conj, formatted = fmt})
end
-- Stringifies lists with "and" or "or"
function p.andList (...) return conjList("and", ...) end
function p.orList (...) return conjList("or", ...) end
--------------------------------------------------------------------------------
-- For see
--
-- Makes a "For X, see [[Y]]." list from raw parameters. Intended for the
-- {{about}} and {{redirect}} templates and their variants.
--------------------------------------------------------------------------------
--default options table used across the forSee family of functions
local forSeeDefaultOptions = {
andKeyword = 'and',
title = mw.title.getCurrentTitle().text,
otherText = 'other uses',
forSeeForm = 'For %s, see %s.',
}
--Collapses duplicate punctuation
function punctuationCollapse (text)
local replacements = {
["%.%.$"] = ".",
["%?%.$"] = "?",
["%!%.$"] = "!",
["%.%]%]%.$"] = ".]]",
["%?%]%]%.$"] = "?]]",
["%!%]%]%.$"] = "!]]"
}
for k, v in pairs(replacements) do text = string.gsub(text, k, v) end
return text
end
-- Structures arguments into a table for stringification, &amp; options
function p.forSeeArgsToTable (args, from, options)
-- Type-checks and defaults
checkType("forSeeArgsToTable", 1, args, 'table')
checkType("forSeeArgsToTable", 2, from, 'number', true)
from = from or 1
checkType("forSeeArgsToTable", 3, options, 'table', true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- maxArg's gotten manually because getArgs() and table.maxn aren't friends
local maxArg = 0
for k, v in pairs(args) do
if type(k) == 'number' and k &gt; maxArg then maxArg = k end
end
-- Structure the data out from the parameter list:
-- * forTable is the wrapper table, with forRow rows
-- * Rows are tables of a "use" string &amp; a "pages" table of pagename strings
-- * Blanks are left empty for defaulting elsewhere, but can terminate list
local forTable = {}
local i = from
local terminated = false
-- If there is extra text, and no arguments are given, give nil value
-- to not produce default of "For other uses, see foo (disambiguation)"
if options.extratext and i &gt; maxArg then return nil end
-- Loop to generate rows
repeat
-- New empty row
local forRow = {}
-- On blank use, assume list's ended &amp; break at end of this loop
forRow.use = args[i]
if not args[i] then terminated = true end
-- New empty list of pages
forRow.pages = {}
-- Insert first pages item if present
table.insert(forRow.pages, args[i + 1])
-- If the param after next is "and", do inner loop to collect params
-- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3}
while args[i + 2] == options.andKeyword do
if args[i + 3] then
table.insert(forRow.pages, args[i + 3])
end
-- Increment to next "and"
i = i + 2
end
-- Increment to next use
i = i + 2
-- Append the row
table.insert(forTable, forRow)
until terminated or i &gt; maxArg
return forTable
end
-- Stringifies a table as formatted by forSeeArgsToTable
function p.forSeeTableToString (forSeeTable, options)
-- Type-checks and defaults
checkType("forSeeTableToString", 1, forSeeTable, "table", true)
checkType("forSeeTableToString", 2, options, "table", true)
options = options or {}
for k, v in pairs(forSeeDefaultOptions) do
if options[k] == nil then options[k] = v end
end
-- Stringify each for-see item into a list
local strList = {}
if forSeeTable then
for k, v in pairs(forSeeTable) do
local useStr = v.use or options.otherText
local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)}
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr)
forSeeStr = punctuationCollapse(forSeeStr)
table.insert(strList, forSeeStr)
end
end
if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end
-- Return the concatenated list
return table.concat(strList, ' ')
end
-- Produces a "For X, see [[Y]]" string from arguments. Expects index gaps
-- but not blank/whitespace values. Ignores named args and args &lt; "from".
function p._forSee (args, from, options)
local forSeeTable = p.forSeeArgsToTable(args, from, options)
return p.forSeeTableToString(forSeeTable, options)
end
-- As _forSee, but uses the frame.
function p.forSee (frame, from, options)
mArguments = require('Module:Arguments')
return p._forSee(mArguments.getArgs(frame), from, options)
end
return p</text>
      <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
    </revision>
  </page>
  <page>
    <title>Module:High-use</title>
    <ns>828</ns>
    <id>62062952</id>
    <revision>
      <id>1050945202</id>
      <parentid>1037252135</parentid>
      <timestamp>2021-10-20T19:51:10Z</timestamp>
      <contributor>
        <username>MusikBot II</username>
        <id>29539620</id>
      </contributor>
      <minor/>
      <comment>Changed protection settings for "[[Module:High-use]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3784 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="6601" xml:space="preserve">local p = {}
-- _fetch looks at the "demo" argument.
local _fetch = require('Module:Transclusion_count').fetch
local yesno = require('Module:Yesno')
function p.num(frame, count)
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
-- Build output string
local return_value = ""
if count == nil then
if frame.args[1] == "risk" then
return_value = "a very large number of"
else
return_value = "many"
end
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if count &gt;= 100000 then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(count)) - sigfig + 1
-- Round and insert "approximately" or "+" when appropriate
if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then
-- Round down
return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format("approximately&amp;#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be &gt;= 1% and when |no-percent= not set to yes
if count and count &gt; 250000 and not yesno (frame:getParent().args['no-percent']) then
local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5)
if percent &gt;= 1 then
return_value = string.format("%s&amp;#x20;pages, or roughly %s%% of all", return_value, percent)
end
end
end
return return_value
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
function p.risk(frame)
local return_value = ""
if frame.args[1] == "risk" then
return_value = "risk"
else
local count = _fetch(frame)
if count and count &gt;= 100000 then return_value = "risk" end
end
return return_value
end
function p.text(frame, count)
-- Only show the information about how this template gets updated if someone
-- is actually editing the page and maybe trying to update the count.
local bot_text = (frame:preprocess("{{REVISIONID}}") == "") and "\n\n----\n'''Preview message''': Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]])." or ''
if count == nil then
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
end
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" or title.subpageText == "sandbox" then
title = title.basePageTitle
end
local systemMessages = frame.args['system']
if frame.args['system'] == '' then
systemMessages = nil
end
local templateCount = ('on [https://templatecount.toolforge.org/index.php?lang=en&amp;namespace=%s&amp;name=%s %s pages]'):format(
mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count))
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
((count and count &gt; 2000) and (",''' and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text =  ("%s's [[%s/sandbox|/sandbox]] or [[%s/testcases|/testcases]] subpages, or in your own [[%s]]. "):format(
(mw.title.getCurrentTitle().namespace == 828 and "module" or "template"),
title.fullText, title.fullText,
mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage"
)
local infoArg = frame.args["info"] ~= "" and frame.args["info"]
if (systemMessages or frame.args[1] == "risk" or (count and count &gt;= 100000) ) then
local info = systemMessages and '.&lt;br/&gt;Changes to it can cause immediate changes to the Wikipedia user interface.' or '.'
if infoArg then
info = info .. "&lt;br /&gt;" .. infoArg
end
sandbox_text = info .. '&lt;br /&gt; To avoid major disruption' ..
(count and count &gt;= 100000 and ' and server load' or '') ..
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.&lt;br /&gt;' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then
discussion_text = string.format("%sat [[%s]]", discussion_text, frame.args["2"])
else
discussion_text = string.format("%son the [[%s|talk page]]", discussion_text, title.talkPageTitle.fullText )
end
return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text
end
function p.main(frame)
local count = nil
if yesno(frame.args['fetch']) == false then
if (frame.args[1] or '') ~= '' then count = tonumber(frame.args[1]) end
else
count = _fetch(frame)
end
local image = "[[File:Ambox warning yellow.svg|40px|alt=Warning|link=]]"
local type_param = "style"
local epilogue = ''
if frame.args['system'] and frame.args['system'] ~= '' then
image = "[[File:Ambox important.svg|40px|alt=Warning|link=]]"
type_param = "content"
local nocat = frame:getParent().args['nocat'] or frame.args['nocat']
local categorise = (nocat == '' or not yesno(nocat))
if categorise then
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}')
end
elseif (frame.args[1] == "risk" or (count and count &gt;= 100000)) then
image = "[[File:Ambox warning orange.svg|40px|alt=Warning|link=]]"
type_param = "content"
end
if frame.args["form"] == "editnotice" then
return frame:expandTemplate{
title = 'editnotice',
args = {
["image"] = image,
["text"] = p.text(frame, count),
["expiry"] = (frame.args["expiry"] or "")
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p.text(frame, count),
expiry = (frame.args["expiry"] or "")
}) .. epilogue
end
end
return p</text>
      <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Infobox</title>
    <ns>828</ns>
    <id>38808424</id>
    <revision>
      <id>1049450226</id>
      <parentid>1049450087</parentid>
      <timestamp>2021-10-11T22:22:54Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>ocd triggered</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="18858" xml:space="preserve">local p = {}
local args = {}
local origArgs = {}
local root
local empty_row_categories = {}
local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]'
local has_rows = false
local function fixChildBoxes(sval, tt)
local function notempty( s ) return s and s:match( '%S' ) end
if notempty(sval) then
local marker = '&lt;span class=special_infobox_marker&gt;'
local s = sval
-- start moving templatestyles and categories inside of table rows
local slast = ''
while slast ~= s do
slast = s
s = mw.ustring.gsub(s, '(&lt;/[Tt][Rr]%s*&gt;%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1')
s = mw.ustring.gsub(s, '(&lt;/[Tt][Rr]%s*&gt;%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1')
end
-- end moving templatestyles and categories inside of table rows
s = mw.ustring.gsub(s, '(&lt;%s*[Tt][Rr])', marker .. '%1')
s = mw.ustring.gsub(s, '(&lt;/[Tt][Rr]%s*&gt;)', '%1' .. marker)
if s:match(marker) then
s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '')
s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1')
s = mw.ustring.gsub(s, '(&lt;/[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*&gt;%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '(&lt;%s*[Tt][Aa][Bb][Ll][Ee][^&lt;&gt;]*&gt;%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1')
s = mw.ustring.gsub(s, marker .. '(%s*&lt;/[Tt][Aa][Bb][Ll][Ee]%s*&gt;)', '%1')
s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1')
end
if s:match(marker) then
local subcells = mw.text.split(s, marker)
s = ''
for k = 1, #subcells do
if k == 1 then
s = s .. subcells[k] .. '&lt;/' .. tt .. '&gt;&lt;/tr&gt;'
elseif k == #subcells then
local rowstyle = ' style="display:none"'
if notempty(subcells[k]) then rowstyle = '' end
s = s .. '&lt;tr' .. rowstyle ..'&gt;&lt;' .. tt .. ' colspan=2&gt;\n' ..
subcells[k]
elseif notempty(subcells[k]) then
if (k % 2) == 0 then
s = s .. subcells[k]
else
s = s .. '&lt;tr&gt;&lt;' .. tt .. ' colspan=2&gt;\n' ..
subcells[k] .. '&lt;/' .. tt .. '&gt;&lt;/tr&gt;'
end
end
end
end
-- the next two lines add a newline at the end of lists for the PHP parser
-- [[Special:Diff/849054481]]
-- remove when [[:phab:T191516]] is fixed or OBE
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1')
s = mw.ustring.gsub(s, '^(%{%|)', '\n%1')
return s
else
return sval
end
end
-- Cleans empty tables
local function cleanInfobox()
root = tostring(root)
if has_rows == false then
root = mw.ustring.gsub(root, '&lt;table[^&lt;&gt;]*&gt;%s*&lt;/table&gt;', '')
end
end
-- Returns the union of the values of two tables, as a sequence.
local function union(t1, t2)
local vals = {}
for k, v in pairs(t1) do
vals[v] = true
end
for k, v in pairs(t2) do
vals[v] = true
end
local ret = {}
for k, v in pairs(vals) do
table.insert(ret, k)
end
return ret
end
-- Returns a table containing the numbers of the arguments that exist
-- for the specified prefix. For example, if the prefix was 'data', and
-- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}.
local function getArgNums(prefix)
local nums = {}
for k, v in pairs(args) do
local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$')
if num then table.insert(nums, tonumber(num)) end
end
table.sort(nums)
return nums
end
-- Adds a row to the infobox, with either a header cell
-- or a label/data cell combination.
local function addRow(rowArgs)
if rowArgs.header and rowArgs.header ~= '_BLANK_' then
has_rows = true
root
:tag('tr')
:addClass(rowArgs.rowclass)
:cssText(rowArgs.rowstyle)
:tag('th')
:attr('colspan', '2')
:addClass('infobox-header')
:addClass(rowArgs.class)
:addClass(args.headerclass)
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-header
:cssText(args.headerstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.header, 'th'))
if rowArgs.data then
root:wikitext(
'[[Category:Pages which use infobox templates with ignored data cells]]'
)
end
elseif rowArgs.data and rowArgs.data:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(rowArgs.rowclass)
row:cssText(rowArgs.rowstyle)
if rowArgs.label then
row
:tag('th')
:attr('scope', 'row')
:addClass('infobox-label')
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-label
:cssText(args.labelstyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(rowArgs.label)
:done()
end
local dataCell = row:tag('td')
dataCell
:attr('colspan', not rowArgs.label and '2' or nil)
:addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data')
:addClass(rowArgs.class)
-- @deprecated next; target .infobox-&lt;name&gt; .infobox(-full)-data
:cssText(rowArgs.datastyle)
:cssText(rowArgs.rowcellstyle)
:wikitext(fixChildBoxes(rowArgs.data, 'td'))
else
table.insert(empty_row_categories, rowArgs.data or '')
end
end
local function renderTitle()
if not args.title then return end
has_rows = true
root
:tag('caption')
:addClass('infobox-title')
:addClass(args.titleclass)
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-title
:cssText(args.titlestyle)
:wikitext(args.title)
end
local function renderAboveRow()
if not args.above then return end
has_rows = true
root
:tag('tr')
:tag('th')
:attr('colspan', '2')
:addClass('infobox-above')
:addClass(args.aboveclass)
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-above
:cssText(args.abovestyle)
:wikitext(fixChildBoxes(args.above,'th'))
end
local function renderBelowRow()
if not args.below then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-below')
:addClass(args.belowclass)
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-below
:cssText(args.belowstyle)
:wikitext(fixChildBoxes(args.below,'td'))
end
local function addSubheaderRow(subheaderArgs)
if subheaderArgs.data and
subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(subheaderArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-subheader')
:addClass(subheaderArgs.class)
:cssText(subheaderArgs.datastyle)
:cssText(subheaderArgs.rowcellstyle)
:wikitext(fixChildBoxes(subheaderArgs.data, 'td'))
else
table.insert(empty_row_categories, subheaderArgs.data or '')
end
end
local function renderSubheaders()
if args.subheader then
args.subheader1 = args.subheader
end
if args.subheaderrowclass then
args.subheaderrowclass1 = args.subheaderrowclass
end
local subheadernums = getArgNums('subheader')
for k, num in ipairs(subheadernums) do
addSubheaderRow({
data = args['subheader' .. tostring(num)],
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-subheader
datastyle = args.subheaderstyle,
rowcellstyle = args['subheaderstyle' .. tostring(num)],
class = args.subheaderclass,
rowclass = args['subheaderrowclass' .. tostring(num)]
})
end
end
local function addImageRow(imageArgs)
if imageArgs.data and
imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then
has_rows = true
local row = root:tag('tr')
row:addClass(imageArgs.rowclass)
local dataCell = row:tag('td')
dataCell
:attr('colspan', '2')
:addClass('infobox-image')
:addClass(imageArgs.class)
:cssText(imageArgs.datastyle)
:wikitext(fixChildBoxes(imageArgs.data, 'td'))
else
table.insert(empty_row_categories, imageArgs.data or '')
end
end
local function renderImages()
if args.image then
args.image1 = args.image
end
if args.caption then
args.caption1 = args.caption
end
local imagenums = getArgNums('image')
for k, num in ipairs(imagenums) do
local caption = args['caption' .. tostring(num)]
local data = mw.html.create():wikitext(args['image' .. tostring(num)])
if caption then
data
:tag('div')
:addClass('infobox-caption')
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-caption
:cssText(args.captionstyle)
:wikitext(caption)
end
addImageRow({
data = tostring(data),
-- @deprecated next; target .infobox-&lt;name&gt; .infobox-image
datastyle = args.imagestyle,
class = args.imageclass,
rowclass = args['imagerowclass' .. tostring(num)]
})
end
end
-- When autoheaders are turned on, preprocesses the rows
local function preprocessRows()
if not args.autoheaders then return end
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
local lastheader
for k, num in ipairs(rownums) do
if args['header' .. tostring(num)] then
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
lastheader = num
elseif args['data' .. tostring(num)] and
args['data' .. tostring(num)]:gsub(
category_in_empty_row_pattern, ''
):match('^%S') then
local data = args['data' .. tostring(num)]
if data:gsub(category_in_empty_row_pattern, ''):match('%S') then
lastheader = nil
end
end
end
if lastheader then
args['header' .. tostring(lastheader)] = nil
end
end
-- Gets the union of the header and data argument numbers,
-- and renders them all in order
local function renderRows()
local rownums = union(getArgNums('header'), getArgNums('data'))
table.sort(rownums)
for k, num in ipairs(rownums) do
addRow({
header = args['header' .. tostring(num)],
label = args['label' .. tostring(num)],
data = args['data' .. tostring(num)],
datastyle = args.datastyle,
class = args['class' .. tostring(num)],
rowclass = args['rowclass' .. tostring(num)],
-- @deprecated next; target .infobox-&lt;name&gt; rowclass
rowstyle = args['rowstyle' .. tostring(num)],
rowcellstyle = args['rowcellstyle' .. tostring(num)]
})
end
end
local function renderNavBar()
if not args.name then return end
has_rows = true
root
:tag('tr')
:tag('td')
:attr('colspan', '2')
:addClass('infobox-navbar')
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
})
end
local function renderItalicTitle()
local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title'])
if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then
root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'}))
end
end
-- Categories in otherwise empty rows are collected in empty_row_categories.
-- This function adds them to the module output. It is not affected by
-- args.decat because this module should not prevent module-external categories
-- from rendering.
local function renderEmptyRowCategories()
for _, s in ipairs(empty_row_categories) do
root:wikitext(s)
end
end
-- Render tracking categories. args.decat == turns off tracking categories.
local function renderTrackingCategories()
if args.decat == 'yes' then return end
if args.child == 'yes' then
if args.title then
root:wikitext(
'[[Category:Pages which use embedded infobox templates with the title parameter]]'
)
end
elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
root:wikitext('[[Category:Articles which use infobox templates with no data rows]]')
end
end
--[=[
Loads the templatestyles for the infobox.
TODO: FINISH loading base templatestyles here rather than in
MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables.
See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :).
When we do this we should clean up the inline CSS below too.
Will have to do some bizarre conversion category like with sidebar.
]=]
local function loadTemplateStyles()
local frame = mw.getCurrentFrame()
-- See function description
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' }
}
local templatestyles = ''
if args['templatestyles'] then templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] then child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
base_templatestyles, -- see function description
templatestyles,
child_templatestyles,
grandchild_templatestyles
})
end
-- common functions between the child and non child cases
local function structure_infobox_common()
renderSubheaders()
renderImages()
preprocessRows()
renderRows()
renderBelowRow()
renderNavBar()
renderItalicTitle()
renderEmptyRowCategories()
renderTrackingCategories()
cleanInfobox()
end
-- Specify the overall layout of the infobox, with special settings if the
-- infobox is used as a 'child' inside another infobox.
local function _infobox()
if args.child ~= 'yes' then
root = mw.html.create('table')
root
:addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox')
:addClass(args.bodyclass)
-- @deprecated next; target .infobox-&lt;name&gt;
:cssText(args.bodystyle)
renderTitle()
renderAboveRow()
else
root = mw.html.create()
root
:wikitext(args.title)
end
structure_infobox_common()
return loadTemplateStyles() .. root
end
-- If the argument exists and isn't blank, add it to the argument table.
-- Blank arguments are treated as nil to match the behaviour of ParserFunctions.
local function preprocessSingleArg(argName)
if origArgs[argName] and origArgs[argName] ~= '' then
args[argName] = origArgs[argName]
end
end
-- Assign the parameters with the given prefixes to the args table, in order, in
-- batches of the step size specified. This is to prevent references etc. from
-- appearing in the wrong order. The prefixTable should be an array containing
-- tables, each of which has two possible fields, a "prefix" string and a
-- "depend" table. The function always parses parameters containing the "prefix"
-- string, but only parses parameters in the "depend" table if the prefix
-- parameter is present and non-blank.
local function preprocessArgs(prefixTable, step)
if type(prefixTable) ~= 'table' then
error("Non-table value detected for the prefix table", 2)
end
if type(step) ~= 'number' then
error("Invalid step value detected", 2)
end
-- Get arguments without a number suffix, and check for bad input.
for i,v in ipairs(prefixTable) do
if type(v) ~= 'table' or type(v.prefix) ~= "string" or
(v.depend and type(v.depend) ~= 'table') then
error('Invalid input detected to preprocessArgs prefix table', 2)
end
preprocessSingleArg(v.prefix)
-- Only parse the depend parameter if the prefix parameter is present
-- and not blank.
if args[v.prefix] and v.depend then
for j, dependValue in ipairs(v.depend) do
if type(dependValue) ~= 'string' then
error('Invalid "depend" parameter value detected in preprocessArgs')
end
preprocessSingleArg(dependValue)
end
end
end
-- Get arguments with number suffixes.
local a = 1 -- Counter variable.
local moreArgumentsExist = true
while moreArgumentsExist == true do
moreArgumentsExist = false
for i = a, a + step - 1 do
for j,v in ipairs(prefixTable) do
local prefixArgName = v.prefix .. tostring(i)
if origArgs[prefixArgName] then
-- Do another loop if any arguments are found, even blank ones.
moreArgumentsExist = true
preprocessSingleArg(prefixArgName)
end
-- Process the depend table if the prefix argument is present
-- and not blank, or we are processing "prefix1" and "prefix" is
-- present and not blank, and if the depend table is present.
if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then
for j,dependValue in ipairs(v.depend) do
local dependArgName = dependValue .. tostring(i)
preprocessSingleArg(dependArgName)
end
end
end
end
a = a + step
end
end
-- Parse the data parameters in the same order that the old {{infobox}} did, so
-- that references etc. will display in the expected places. Parameters that
-- depend on another parameter are only processed if that parameter is present,
-- to avoid phantom references appearing in article reference lists.
local function parseDataParameters()
preprocessSingleArg('autoheaders')
preprocessSingleArg('child')
preprocessSingleArg('bodyclass')
preprocessSingleArg('subbox')
preprocessSingleArg('bodystyle')
preprocessSingleArg('title')
preprocessSingleArg('titleclass')
preprocessSingleArg('titlestyle')
preprocessSingleArg('above')
preprocessSingleArg('aboveclass')
preprocessSingleArg('abovestyle')
preprocessArgs({
{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}
}, 10)
preprocessSingleArg('subheaderstyle')
preprocessSingleArg('subheaderclass')
preprocessArgs({
{prefix = 'image', depend = {'caption', 'imagerowclass'}}
}, 10)
preprocessSingleArg('captionstyle')
preprocessSingleArg('imagestyle')
preprocessSingleArg('imageclass')
preprocessArgs({
{prefix = 'header'},
{prefix = 'data', depend = {'label'}},
{prefix = 'rowclass'},
{prefix = 'rowstyle'},
{prefix = 'rowcellstyle'},
{prefix = 'class'}
}, 50)
preprocessSingleArg('headerclass')
preprocessSingleArg('headerstyle')
preprocessSingleArg('labelstyle')
preprocessSingleArg('datastyle')
preprocessSingleArg('below')
preprocessSingleArg('belowclass')
preprocessSingleArg('belowstyle')
preprocessSingleArg('name')
-- different behaviour for italics if blank or absent
args['italic title'] = origArgs['italic title']
preprocessSingleArg('decat')
preprocessSingleArg('templatestyles')
preprocessSingleArg('child templatestyles')
preprocessSingleArg('grandchild templatestyles')
end
-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
function p.infobox(frame)
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
parseDataParameters()
return _infobox()
end
-- For calling via #invoke within a template
function p.infoboxTemplate(frame)
origArgs = {}
for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end
parseDataParameters()
return _infobox()
end
return p</text>
      <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Infobox/styles.css</title>
    <ns>828</ns>
    <id>68912159</id>
    <revision>
      <id>1048617464</id>
      <parentid>1048616812</parentid>
      <timestamp>2021-10-07T01:18:14Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>add a stronger note</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="651" xml:space="preserve">/* {{pp|small=y}} */
/*
* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]]
* DO NOT ADD THEM HERE
*/
/*
* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/
.infobox-subbox {
padding: 0;
border: none;
margin: -3px;
width: auto;
min-width: 100%;
font-size: 100%;
clear: none;
float: none;
background-color: transparent;
}
.infobox-3cols-child {
margin: auto;
}</text>
      <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
    </revision>
  </page>
  <page>
    <title>Module:List</title>
    <ns>828</ns>
    <id>41068627</id>
    <revision>
      <id>915206629</id>
      <parentid>914636065</parentid>
      <timestamp>2019-09-11T21:05:14Z</timestamp>
      <contributor>
        <username>Paine Ellsworth</username>
        <id>9092818</id>
      </contributor>
      <comment>xfer from sandbox per edit request on talk page</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,
-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes
data.classes = {}
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist hlist-separated')
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent &gt; 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for i, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items &lt; 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for i, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for i, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p</text>
      <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Lua banner</title>
    <ns>828</ns>
    <id>42951651</id>
    <revision>
      <id>1043920761</id>
      <parentid>961849059</parentid>
      <timestamp>2021-09-12T17:48:53Z</timestamp>
      <contributor>
        <username>Andrybak</username>
        <id>23735172</id>
      </contributor>
      <comment>bypass redirect on Commons for [[:File:Lua-Logo.svg]] – requested by [[User:Christian75]] in [[Special:Diff/1043853071]]</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="3872" xml:space="preserve">-- This module implements the {{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules &lt; 1 then
boxArgs.text = '&lt;strong class="error"&gt;Error: no modules specified&lt;/strong&gt;'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'This module depends on the following other modules:' .. moduleList
else
boxArgs.text = 'This template  uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules &lt; 1 then
cats[#cats + 1] = 'Lua templates with errors'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if not subpageBlacklist[titleObj.subpageText] then
local protCatName
if titleObj.namespace == 10 then
local category = args.category
if not category then
local categories = {
['Module:String'] = 'Lua String-based templates',
['Module:Math'] = 'Templates based on the Math Lua module',
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',
['Module:Citation'] = 'Lua-based citation templates'
}
categories['Module:Citation/CS1'] = categories['Module:Citation']
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates'
end
cats[#cats + 1] = category
protCatName = "Templates using under-protected Lua modules"
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt &lt; currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p</text>
      <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Message box</title>
    <ns>828</ns>
    <id>40574910</id>
    <revision>
      <id>1027212344</id>
      <parentid>970994177</parentid>
      <timestamp>2021-06-06T18:51:34Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>per tper</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="18348" xml:space="preserve">-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Load necessary modules.
require('Module:No globals')
local getArgs
local yesno = require('Module:Yesno')
-- Get a language object for formatDate and ucfirst.
local lang = mw.language.getContentLanguage()
-- Define constants
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{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
                if self.isSmall then
                    local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                    talkText = string.format('([[%s|talk]])', talkLink)
                else
                    talkText = 'Relevant discussion may be found on'
                    if talkArgIsTalkPage then
                        talkText = string.format(
                            '%s [[%s|%s]].',
                            talkText,
                            talk,
                            talkTitle.prefixedText
                        )
                    else
                        talkText = string.format(
                            '%s the [[%s#%s|talk page]].',
                            talkText,
                            talkTitle.prefixedText,
                            talk
                        )
                    end
                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(" &lt;span class='date-container'&gt;''(&lt;span class='date'&gt;%s&lt;/span&gt;)''&lt;/span&gt;", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
if cfg.imageEmptyCellStyle then
self.imageEmptyCellStyle = 'border:none;padding:0;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('[[File:%s|%s|link=|alt=]]', 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 {{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 &gt; 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums &gt; 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
end
if self.isSubstituted then
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'Template &lt;code&gt;%s[[Template:%s|%s]]%s&lt;/code&gt; has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):css('width', '52px')
end
imageLeftCell:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
:cssText(self.imageEmptyCellStyle or nil)
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):css('width', '52px')
end
imageRightCell
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:css('text-align', 'center')
:wikitext(string.format(
'This message box is using an invalid "type=%s" parameter and needs fixing.',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)</text>
      <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Message box/configuration</title>
    <ns>828</ns>
    <id>40627038</id>
    <revision>
      <id>948472514</id>
      <parentid>948472513</parentid>
      <timestamp>2020-04-01T06:12:44Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <minor/>
      <comment>1 revision imported</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------
--                          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 = 'Semi-protection-shackle-keyhole.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', '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'},
removalNotice              = '[[Help:Maintenance template removal|Learn how and when to remove this template message]]'
},
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 = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default              = 'notice',
showInvalidTypeError = true,
classes              = {'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,
classes              = {'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 = 'Semi-protection-shackle-keyhole.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'},
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 = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default              = 'notice',
showInvalidTypeError = true,
classes              = {'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 = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default              = 'notice',
showInvalidTypeError = true,
classes              = {'tmbox'},
allowSmall          = true,
imageRightNone      = true,
imageEmptyCell      = true,
imageEmptyCellStyle  = true,
templateCategory    = 'Talk message boxes'
}
}</text>
      <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Navbar</title>
    <ns>828</ns>
    <id>38827227</id>
    <revision>
      <id>1040458691</id>
      <parentid>992953067</parentid>
      <timestamp>2021-08-24T17:32:47Z</timestamp>
      <contributor>
        <username>WOSlinker</username>
        <id>3138265</id>
      </contributor>
      <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="5152" xml:space="preserve">local p = {}
local cfg = mw.loadData('Module:Navbar/configuration')
local function get_title_arg(is_collapsible, template)
local title_arg = 1
if is_collapsible then title_arg = 2 end
if template then title_arg = 'template' end
return title_arg
end
local function choose_links(template, args)
-- The show table indicates the default displayed items.
-- view, talk, edit, hist, move, watch
-- TODO: Move to configuration.
local show = {true, true, true, false, false, false}
if template then
show[2] = false
show[3] = false
local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6,
talk = 2, edit = 3, hist = 4, move = 5, watch = 6}
-- TODO: Consider removing TableTools dependency.
for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do
local num = index[v]
if num then show[num] = true end
end
end
local remove_edit_link = args.noedit
if remove_edit_link then show[3] = false end
return show
end
local function add_link(link_description, ul, is_mini, font_style)
local l
if link_description.url then
l = {'[', '', ']'}
else
l = {'[[', '|', ']]'}
end
ul:tag('li')
:addClass('nv-' .. link_description.full)
:wikitext(l[1] .. link_description.link .. l[2])
:tag(is_mini and 'abbr' or 'span')
:attr('title', link_description.html_title)
:cssText(font_style)
:wikitext(is_mini and link_description.mini or link_description.full)
:done()
:wikitext(l[3])
:done()
end
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
if not title then
error(cfg.invalid_title .. title_text)
end
local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''
-- TODO: Get link_descriptions and show into the configuration module.
-- link_descriptions should be easier...
local link_descriptions = {
{ ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template',
['link'] = title.fullText, ['url'] = false },
{ ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template',
['link'] = talkpage, ['url'] = false },
{ ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template',
['link'] = title:fullUrl('action=edit'), ['url'] = true },
{ ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template',
['link'] = title:fullUrl('action=history'), ['url'] = true },
{ ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template',
['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true },
{ ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template',
['link'] = title:fullUrl('action=watch'), ['url'] = true }
}
local ul = mw.html.create('ul')
if has_brackets then
ul:addClass(cfg.classes.brackets)
:cssText(font_style)
end
for i, _ in ipairs(displayed_links) do
if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end
end
return ul:done()
end
function p._navbar(args)
-- TODO: We probably don't need both fontstyle and fontcolor...
local font_style = args.fontstyle
local font_color = args.fontcolor
local is_collapsible = args.collapsible
local is_mini = args.mini
local is_plain = args.plain
local collapsible_class = nil
if is_collapsible then
collapsible_class = cfg.classes.collapsible
if not is_plain then is_mini = 1 end
if font_color then
font_style = (font_style or '') .. '; color: ' .. font_color .. ';'
end
end
font_style = (font_style or '') .. ';text-decoration:inherit;'
local navbar_style = args.style
local div = mw.html.create():tag('div')
div
:addClass(cfg.classes.navbar)
:addClass(cfg.classes.plainlinks)
:addClass(cfg.classes.horizontal_list)
:addClass(collapsible_class) -- we made the determination earlier
:cssText(navbar_style)
if is_mini then div:addClass(cfg.classes.mini) end
local box_text = (args.text or cfg.box_text) .. ' '
-- the concatenated space guarantees the box text is separated
if not (is_mini or is_plain) then
div
:tag('span')
:addClass(cfg.classes.box_text)
:cssText(font_style)
:wikitext(box_text)
end
local template = args.template
local displayed_links = choose_links(template, args)
local has_brackets = args.brackets
local title_arg = get_title_arg(is_collapsible, template)
local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
div:node(list)
if is_collapsible then
local title_text_class
if is_mini then
title_text_class = cfg.classes.collapsible_title_mini
else
title_text_class = cfg.classes.collapsible_title_full
end
div:done()
:tag('div')
:addClass(title_text_class)
:cssText(font_style)
:wikitext(args[1])
end
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = cfg.templatestyles }
} .. tostring(div:done())
end
function p.navbar(frame)
return p._navbar(require('Module:Arguments').getArgs(frame))
end
return p</text>
      <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Navbar/configuration</title>
    <ns>828</ns>
    <id>66010105</id>
    <revision>
      <id>992950717</id>
      <parentid>992950579</parentid>
      <timestamp>2020-12-08T00:17:17Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <minor/>
      <comment>Protected "[[Module:Navbar/configuration]]": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="904" xml:space="preserve">local configuration = {
['templatestyles'] = 'Module:Navbar/styles.css',
['box_text'] = 'This box: ', -- default text box when not plain or mini
['title_namespace'] = 'Template', -- namespace to default to for title
['invalid_title'] = 'Invalid title ',
['classes'] = { -- set a line to nil if you don't want it
['navbar'] = 'navbar',
['plainlinks'] = 'plainlinks', -- plainlinks
['horizontal_list'] = 'hlist', -- horizontal list class
['mini'] = 'navbar-mini', -- class indicating small links in the navbar
['this_box'] = 'navbar-boxtext',
['brackets'] = 'navbar-brackets',
-- 'collapsible' is the key for a class to indicate the navbar is
-- setting up the collapsible element in addition to the normal
-- navbar.
['collapsible'] = 'navbar-collapse',
['collapsible_title_mini'] = 'navbar-ct-mini',
['collapsible_title_full'] = 'navbar-ct-full'
}
}
return configuration</text>
      <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Navbar/styles.css</title>
    <ns>828</ns>
    <id>58923020</id>
    <revision>
      <id>992953826</id>
      <parentid>992950418</parentid>
      <timestamp>2020-12-08T00:40:59Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="1107" xml:space="preserve">/* {{pp|small=yes}} */
.navbar {
display: inline;
font-size: 88%;
font-weight: normal;
}
.navbar-collapse {
float: left;
text-align: left;
}
.navbar-boxtext {
word-spacing: 0;
}
.navbar ul {
display: inline-block;
white-space: nowrap;
line-height: inherit;
}
.navbar-brackets::before {
margin-right: -0.125em;
content: '[ ';
}
.navbar-brackets::after {
margin-left: -0.125em;
content: ' ]';
}
.navbar li {
word-spacing: -0.125em;
}
.navbar-mini abbr {
font-variant: small-caps;
border-bottom: none;
text-decoration: none;
cursor: inherit;
}
.navbar-ct-full {
font-size: 114%;
margin: 0 7em;
}
.navbar-ct-mini {
font-size: 114%;
margin: 0 4em;
}
/* Navbar styling when nested in infobox and navbox
Should consider having a separate TemplateStyles for those specific places
using an infobox/navbox and a navbar, or possibly override from using template */
.infobox .navbar {
font-size: 100%;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}</text>
      <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
    </revision>
  </page>
  <page>
    <title>Module:No globals</title>
    <ns>828</ns>
    <id>42567026</id>
    <revision>
      <id>948473889</id>
      <parentid>948472526</parentid>
      <timestamp>2020-04-01T06:28:55Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <comment>Undid revision 948472525 by [[Special:Contributions/w&gt;DiBabelYurikBot|w&gt;DiBabelYurikBot]] ([[User talk:w&gt;DiBabelYurikBot|talk]])</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="307" xml:space="preserve">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:Parameter names example</title>
    <ns>828</ns>
    <id>43325707</id>
    <revision>
      <id>947413724</id>
      <parentid>804712407</parentid>
      <timestamp>2020-03-26T04:07:47Z</timestamp>
      <contributor>
        <username>Andrybak</username>
        <id>23735172</id>
      </contributor>
      <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="1599" xml:space="preserve">-- This module implements {{parameter names example}}.
local p = {}
local function makeParam(s)
local lb = '&amp;#123;'
local rb = '&amp;#125;'
return lb:rep(3) .. s .. rb:rep(3)
end
local function italicize(s)
return "''" .. s .. "''"
end
local function plain(s)
return s
end
function p._main(args, frame)
-- Find how we want to format the arguments to the template.
local formatFunc
if args._display == 'italics' or args._display == 'italic' then
formatFunc = italicize
elseif args._display == 'plain' then
formatFunc = plain
else
formatFunc = makeParam
end
-- Build the table of template arguments.
local targs = {}
for k, v in pairs(args) do
if type(k) == 'number' then
targs[v] = formatFunc(v)
elseif not k:find('^_') then
targs[k] = v
end
end
targs['nocat'] = 'yes';
targs['categories'] = 'no';
targs['demo'] = 'yes';
-- Find the template name.
local template
if args._template then
template = args._template
else
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.prefixedText:find('/sandbox$') then
template = currentTitle.prefixedText
else
template = currentTitle.basePageTitle.prefixedText
end
end
-- Call the template with the arguments.
frame = frame or mw.getCurrentFrame()
local success, result = pcall(
frame.expandTemplate,
frame,
{title = template, args = targs}
)
if success then
return result
else
return ''
end
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Parameter names example'
})
return p._main(args, frame)
end
return p</text>
      <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Protection banner</title>
    <ns>828</ns>
    <id>42040984</id>
    <revision>
      <id>1033879006</id>
      <parentid>1013845490</parentid>
      <timestamp>2021-07-16T11:59:29Z</timestamp>
      <contributor>
        <username>ProcrastinatingReader</username>
        <id>32939139</id>
      </contributor>
      <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="26029" xml:space="preserve">-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
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
-- Given a directed graph formatted as node -&gt; table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, 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) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = 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 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
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
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:isUserScript()
-- Whether the page is a user JavaScript or CSS page.
local title = self.title
return title.namespace == 2 and (
title.contentModel == 'javascript' or title.contentModel == 'css'
)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:shouldShowLock()
-- Whether we should output a banner/padlock
return self:isProtected() and not self:isUserScript()
end
-- Whether this page needs a protection category.
Protection.shouldHaveProtectionCategory = Protection.shouldShowLock
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
if not self:shouldHaveProtectionCategory() then
return ''
end
local cfg = self._cfg
local title = self.title
-- 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 = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
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.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- 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 &gt; 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:isIncorrect()
local expiry = self.expiry
return not self:shouldHaveProtectionCategory()
or type(expiry) == 'number' and expiry &lt; 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: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 == 'extendedconfirmed' then
requestType = 'extended'
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:%s#%s|%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 mw.getCurrentFrame():expandTemplate{
title="vandal-m",
args={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:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
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.imageWidth = 40
obj.imageCaption = 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 '&lt;br /&gt;' .. 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.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
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 not yesno(args.catonly) and (protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Protection banner/config</title>
    <ns>828</ns>
    <id>42982788</id>
    <revision>
      <id>1035904400</id>
      <parentid>1033879097</parentid>
      <timestamp>2021-07-28T10:04:57Z</timestamp>
      <contributor>
        <username>ProcrastinatingReader</username>
        <id>32939139</id>
      </contributor>
      <comment>remove dupe</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="46013" xml:space="preserve">-- 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.
--
-- ${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, autoreview and upload subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
default = {
alt = 'Page protected with pending changes',
tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users',
image = 'Pending-protection-shackle.svg'
}
},
upload = {}
},
-- 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, autoreview and upload 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&amp;nbsp;policy on&amp;nbsp;the&amp;nbsp;biographies"
.. ' of&amp;nbsp;living&amp;nbsp;people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living persons',
},
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 = 'Office-protection-shackle.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:%s#%s|%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',
},
ecp = {
description = 'For articles in topic areas authorized by'
.. ' [[Wikipedia:Arbitration Committee|ArbCom]] or'
.. ' meets the criteria for community use',
tooltip = 'This ${PAGETYPE} is extended-confirmed protected',
alt = 'Extended-protected ${PAGETYPE}',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]]',
text = 'This file is currently'
.. ' [[Wikipedia:This page is protected|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}.'
.. '&lt;br /&gt;&lt;span style="font-size:90%;"&gt;'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.&lt;/span&gt;',
},
office = {
description = 'For pages protected by the Wikimedia Foundation',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|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 = 'Office-protection-shackle.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'
.. ' [[Wikipedia:Office actions|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'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|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 = 'Office-protection-shackle.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[Wikipedia:Sock puppetry|sock puppetry]]',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikipedia:Blocking policy|blocked]] or'
.. ' [[Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules',
text = 'This is a permanently [[Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] or'
.. ' [[Wikipedia:Template editor|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'
.. ' [[Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikipedia:Requests for page protection|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'
.. ' &amp;#123;&amp;#123;[[Template:unblock|unblock]]&amp;#125;&amp;#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]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism|vandalism]]',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|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 = 'Move-protection-shackle.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]]'
}
},
autoreview = {},
upload = {}
},
--------------------------------------------------------------------------------
--
--                            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, autoreview and upload subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|'
.. '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 [[Help:Protection|disabled]]',
extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection',
},
move = {
default = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]'
.. ' from [[Help:Moving a page|page moves]]'
},
autoreview = {
default = 'All edits made to this ${PAGETYPE} by'
.. ' [[Wikipedia:User access levels#New users|new]] or'
.. ' [[Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[Wikipedia:Pending changes|subject to review]]'
},
upload = {
default = 'Uploading new versions of this ${PAGETYPE} is currently disabled'
}
},
--------------------------------------------------------------------------------
-- 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, autoreview and upload subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikipedia:Protection policy|'
.. '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]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikipedia:Protection policy|'
.. '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]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
extendedconfirmed = {
default = 'Extended confirmed protection prevents edits from all unregistered editors'
.. ' and registered users with fewer than 30 days tenure and 500 edits.'
.. ' The [[Wikipedia:Protection policy#extended|policy on community use]]'
.. ' specifies that extended confirmed protection can be applied to combat'
.. ' disruption, if semi-protection has proven to be ineffective.'
.. ' Extended confirmed protection may also be applied to enforce'
.. ' [[Wikipedia:Arbitration Committee|arbitration sanctions]].'
.. ' Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask for uncontroversial changes supported by'
.. ' [[Wikipedia:Consensus|consensus]].'
},
default = {
subject = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|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 [[Wikipedia:Protection policy|'
.. '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 [[Wikipedia:Protection policy|'
.. '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'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikipedia:Protection policy|'
.. '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'
.. ' [[Wikipedia:Requests for page protection|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. '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]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
},
upload = {
default = {
default = 'See the [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but new versions of the file'
.. ' cannot be uploaded until it is unprotected. You can'
.. ' request that a new version be uploaded by using a'
.. ' [[Wikipedia:Edit requests|protected edit request]], or you'
.. ' can  [[Wikipedia:Requests for page protection|request]]'
.. ' that the file be unprotected.'
}
}
},
--------------------------------------------------------------------------------
-- 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 protection 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, autoreview and upload subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
extendedconfirmed = 'extended-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
},
upload = {
default = 'upload-protected'
}
},
--------------------------------------------------------------------------------
-- 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 = 'Full-protection-shackle.svg',
templateeditor = 'Template-protection-shackle.svg',
extendedconfirmed = 'Extended-protection-shackle.svg',
autoconfirmed = 'Semi-protection-shackle.svg'
},
move = {
default = 'Move-protection-shackle.svg',
},
autoreview = {
default = 'Pending-protection-shackle.svg'
},
upload = {
default = 'Upload-protection-shackle.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, autoreview and upload subtables.
imageLinks = {
edit = {
default = 'Wikipedia:Protection policy#full',
templateeditor = 'Wikipedia:Protection policy#template',
extendedconfirmed = 'Wikipedia:Protection policy#extended',
autoconfirmed = 'Wikipedia:Protection policy#semi'
},
move = {
default = 'Wikipedia:Protection policy#move'
},
autoreview = {
default = 'Wikipedia:Protection policy#pending'
},
upload = {
default = 'Wikipedia:Protection policy#upload'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the &lt;indicator&gt; extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- 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 fully 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']                = 'Wikipedia fully-protected main page files',
['all|all|all|extendedconfirmed|all']      = 'Wikipedia extended-confirmed-protected pages',
['all|all|ecp|extendedconfirmed|all']      = 'Wikipedia extended-confirmed-protected pages',
['all|template|all|all|edit']              = 'Wikipedia fully 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']        = 'Wikipedia semi-protected files',
['all|portal|all|autoconfirmed|edit']      = 'Wikipedia semi-protected portals',
['all|project|all|autoconfirmed|edit']      = 'Wikipedia semi-protected project pages',
['all|talk|all|autoconfirmed|edit']        = 'Wikipedia 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|template|all|templateeditor|edit']    = 'Wikipedia template-protected templates',
['all|template|all|templateeditor|move']    = 'Wikipedia template-protected templates', -- move-protected templates
['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 fully protected categories',
['all|file|all|sysop|edit']                = 'Wikipedia fully-protected files',
['all|project|all|sysop|edit']              = 'Wikipedia fully-protected project pages',
['all|talk|all|sysop|edit']                = 'Wikipedia fully-protected talk pages',
['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates',
['all|template|all|sysop|edit']            = 'Wikipedia fully protected templates',
['all|user|all|sysop|edit']                = 'Wikipedia fully protected user and user talk pages',
['all|module|all|all|edit']                = 'Wikipedia fully-protected modules',
['all|module|all|templateeditor|edit']      = 'Wikipedia template-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|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',
['all|file|all|all|upload']                = 'Wikipedia upload-protected files',
},
--------------------------------------------------------------------------------
-- 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,
upload = false
},
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'},
extendedconfirmed = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'},
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
-- &lt;noinclude&gt;...&lt;/noinclude&gt; tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. However, users can override any of the
-- arguments.
wrappers = {
['Template:Pp']                        = {},
['Template:Pp-extended']                = {'ecp'},
['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', catonly = 'yes'},
['Template:Pp-move-dispute']            = {'dispute', action = 'move', catonly = 'yes'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism']          = {'vandalism', action = 'move', catonly = 'yes'},
['Template:Pp-office']                  = {'office'},
['Template:Pp-office-dmca']            = {'dmca'},
['Template:Pp-pc']                      = {action = 'autoreview', small = true},
['Template:Pp-pc1']                    = {action = 'autoreview', small = true},
['Template:Pp-reset']                  = {'reset'},
['Template:Pp-semi-indef']              = {small = true},
['Template:Pp-sock']                    = {'sock'},
['Template:Pp-template']                = {'template', small = true},
['Template:Pp-upload']                  = {action = 'upload'},
['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 [[Wikipedia:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|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 "at" H:i e',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates',
['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'] = 'Full-protection-shackle.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}</text>
      <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Sidebar</title>
    <ns>828</ns>
    <id>38866323</id>
    <revision>
      <id>1036808367</id>
      <parentid>1013637399</parentid>
      <timestamp>2021-08-02T20:35:56Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>make wraplinks work like it used to</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="10521" xml:space="preserve">--
-- This module implements {{Sidebar}}
--
require('Module:No globals')
local cfg = mw.loadData('Module:Sidebar/configuration')
local p = {}
local getArgs = require('Module:Arguments').getArgs
--[[
Categorizes calling templates and modules with a 'style' parameter of any sort
for tracking to convert to TemplateStyles.
TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module.
TODO would probably want to remove /log and /archive as CS1 does
]]
local function categorizeTemplatesWithInlineStyles(args)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 and title.namespace ~= 828 then return '' end
for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do
if title.text:match(pattern) then return '' end
end
for key, _ in pairs(args) do
if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then
return cfg.i18n.category.conversion
end
end
end
--[[
For compatibility with the original {{sidebar with collapsible lists}}
implementation, which passed some parameters through {{#if}} to trim their
whitespace. This also triggered the automatic newline behavior.
]]
-- See ([[meta:Help:Newlines and spaces#Automatic newline]])
local function trimAndAddAutomaticNewline(s)
s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1")
if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then
return '\n' .. s
else
return s
end
end
--[[
Finds whether a sidebar has a subgroup sidebar.
]]
local function hasSubgroup(s)
if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then
return true
else
return false
end
end
--[[
Main sidebar function. Takes the frame, args, and an optional collapsibleClass.
The collapsibleClass is and should be used only for sidebars with collapsible
lists, as in p.collapsible.
]]
function p.sidebar(frame, args, collapsibleClass)
if not args then
args = getArgs(frame)
end
local root = mw.html.create()
local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes
root = root:tag('table')
if not child then
root
:addClass(cfg.i18n.class.sidebar)
-- force collapsibleclass to be sidebar-collapse otherwise output nothing
:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)
:addClass('nomobile')
:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)
:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)
:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)
:addClass(args.bodyclass or args.class)
:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)
if args.outertitle then
root
:tag('caption')
:addClass(cfg.i18n.class.outer_title)
:addClass(args.outertitleclass)
:cssText(args.outertitlestyle)
:wikitext(args.outertitle)
end
if args.topimage then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.top_image)
:addClass(args.topimageclass)
:cssText(args.topimagestyle)
:wikitext(args.topimage)
if args.topcaption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.top_caption)
:cssText(args.topcaptionstyle)
:wikitext(args.topcaption)
end
end
if args.pretitle then
root
:tag('tr')
:tag('td')
:addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image
or cfg.i18n.class.pretitle)
:addClass(args.pretitleclass)
:cssText(args.basestyle)
:cssText(args.pretitlestyle)
:wikitext(args.pretitle)
end
else
root
:addClass(cfg.i18n.class.subgroup)
:addClass(args.bodyclass or args.class)
:cssText(args.bodystyle or args.style)
end
if args.title then
if child then
root
:wikitext(args.title)
else
root
:tag('tr')
:tag('th')
:addClass(args.pretitle and cfg.i18n.class.title_with_pretitle
or cfg.i18n.class.title)
:addClass(args.titleclass)
:cssText(args.basestyle)
:cssText(args.titlestyle)
:wikitext(args.title)
end
end
if args.image then
local imageCell = root:tag('tr'):tag('td')
imageCell
:addClass(cfg.i18n.class.image)
:addClass(args.imageclass)
:cssText(args.imagestyle)
:wikitext(args.image)
if args.caption then
imageCell
:tag('div')
:addClass(cfg.i18n.class.caption)
:cssText(args.captionstyle)
:wikitext(args.caption)
end
end
if args.above then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.above)
:addClass(args.aboveclass)
:cssText(args.abovestyle)
:newline() -- newline required for bullet-points to work
:wikitext(args.above)
end
local rowNums = {}
for k, v in pairs(args) do
k = '' .. k
local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$')
if num then table.insert(rowNums, tonumber(num)) end
end
table.sort(rowNums)
-- remove duplicates from the list (e.g. 3 will be duplicated if both heading3
-- and content3 are specified)
for i = #rowNums, 1, -1 do
if rowNums[i] == rowNums[i - 1] then
table.remove(rowNums, i)
end
end
for i, num in ipairs(rowNums) do
local heading = args['heading' .. num]
if heading then
root
:tag('tr')
:tag('th')
:addClass(cfg.i18n.class.heading)
:addClass(args.headingclass)
:addClass(args['heading' .. num .. 'class'])
:cssText(args.basestyle)
:cssText(args.headingstyle)
:cssText(args['heading' .. num .. 'style'])
:newline()
:wikitext(heading)
end
local content = args['content' .. num]
if content then
root
:tag('tr')
:tag('td')
:addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup
or cfg.i18n.class.content)
:addClass(args.contentclass)
:addClass(args['content' .. num .. 'class'])
:cssText(args.contentstyle)
:cssText(args['content' .. num .. 'style'])
:newline()
:wikitext(content)
:done()
-- Without a linebreak after the &lt;/td&gt;, a nested list like
-- "* {{hlist| ...}}" doesn't parse correctly.
:newline()
end
end
if args.below then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.below)
:addClass(args.belowclass)
:cssText(args.belowstyle)
:newline()
:wikitext(args.below)
end
if not child then
if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and
(args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~=
cfg.i18n.title_not_to_add_navbar) then
root
:tag('tr')
:tag('td')
:addClass(cfg.i18n.class.navbar)
:cssText(args.navbarstyle)
:wikitext(require('Module:Navbar')._navbar{
args.name,
mini = 1,
fontstyle = args.navbarfontstyle
})
end
end
local base_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = cfg.i18n.templatestyles }
}
local templatestyles = ''
if args['templatestyles'] and args['templatestyles'] ~= '' then
templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['templatestyles'] }
}
end
local child_templatestyles = ''
if args['child templatestyles'] and args['child templatestyles'] ~= '' then
child_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['child templatestyles'] }
}
end
local grandchild_templatestyles = ''
if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then
grandchild_templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = args['grandchild templatestyles'] }
}
end
return table.concat({
base_templatestyles,
templatestyles,
child_templatestyles,
grandchild_templatestyles,
tostring(root),
(child and cfg.i18n.category.child or ''),
categorizeTemplatesWithInlineStyles(args)
})
end
local function list_title(args, is_centered_list_titles, num)
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title']
or cfg.i18n.default_list_title)
local title
if is_centered_list_titles then
-- collapsible can be finicky, so provide some CSS/HTML to support
title = mw.html.create('div')
:addClass(cfg.i18n.class.list_title_centered)
:wikitext(title_text)
else
title = mw.html.create()
:wikitext(title_text)
end
local title_container = mw.html.create('div')
:addClass(cfg.i18n.class.list_title)
-- don't /need/ a listnumtitleclass because you can do
-- .templateclass .listnumclass .sidebar-list-title
:addClass(args.listtitleclass)
:cssText(args.basestyle)
:cssText(args.listtitlestyle)
:cssText(args['list' .. num .. 'titlestyle'])
:node(title)
:done()
return title_container
end
--[[
Main entry point for sidebar with collapsible lists.
Does the work of creating the collapsible lists themselves and including them
into the args.
]]
function p.collapsible(frame)
local args = getArgs(frame)
if not args.name and
frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') ==
cfg.i18n.collapse_title_not_to_add_navbar then
args.navbar = cfg.i18n.navbar_none
end
local contentArgs = {}
local is_centered_list_titles
if args['centered list titles'] and args['centered list titles'] ~= '' then
is_centered_list_titles = true
else
is_centered_list_titles = false
end
for k, v in pairs(args) do
local num = string.match(k, '^list(%d+)$')
if num then
local expand = args.expanded and
(args.expanded == 'all' or args.expanded == args['list' .. num .. 'name'])
local row = mw.html.create('div')
row
:addClass(cfg.i18n.class.list)
:addClass('mw-collapsible')
:addClass((not expand) and 'mw-collapsed' or nil)
:addClass(args['list' .. num .. 'class'])
:cssText(args.listframestyle)
:cssText(args['list' .. num .. 'framestyle'])
:node(list_title(args, is_centered_list_titles, num))
:tag('div')
:addClass(cfg.i18n.class.list_content)
:addClass('mw-collapsible-content')
-- don't /need/ a listnumstyleclass because you can do
-- .templatename .listnumclass .sidebar-list
:addClass(args.listclass)
:cssText(args.liststyle)
:cssText(args['list' .. num .. 'style'])
:wikitext(trimAndAddAutomaticNewline(args['list' .. num]))
contentArgs['content' .. num] = tostring(row)
end
end
for k, v in pairs(contentArgs) do
args[k] = v
end
return p.sidebar(frame, args, cfg.i18n.class.collapse)
end
return p</text>
      <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Sidebar/configuration</title>
    <ns>828</ns>
    <id>66261134</id>
    <revision>
      <id>1036808391</id>
      <parentid>1013635331</parentid>
      <timestamp>2021-08-02T20:36:03Z</timestamp>
      <contributor>
        <username>Izno</username>
        <id>2927383</id>
      </contributor>
      <comment>wraplinks work like it used to</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="1698" xml:space="preserve">return {
i18n = {
child_yes = 'yes',
float_none = 'none',
float_left = 'left',
wrap_true = 'true',
navbar_none = 'none',
navbar_off = 'off',
default_list_title = 'List',
title_not_to_add_navbar = 'Template:Sidebar',
collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists',
templatestyles = 'Module:Sidebar/styles.css',
category = {
child = '[[Category:Pages using sidebar with the child parameter]]',
conversion = '[[Category:Sidebars with styles needing conversion]]'
},
pattern = {
collapse_sandbox = '/sandbox$',
sandbox = '/sandbox$',
subgroup = 'sidebar%-subgroup',
style_conversion = 'style$',
uncategorized_conversion_titles = {
'/[Ss]andbox',
'/[Tt]estcases',
'/[Dd]oc$'
}
},
class = {
sidebar = 'sidebar',
subgroup = 'sidebar-subgroup',
collapse = 'sidebar-collapse',
float_none = 'sidebar-none',
float_left = 'sidebar-left',
wraplinks = 'nowraplinks',
outer_title = 'sidebar-outer-title',
top_image = 'sidebar-top-image',
top_caption = 'sidebar-top-caption',
pretitle = 'sidebar-pretitle',
pretitle_with_top_image = 'sidebar-pretitle-with-top-image',
title = 'sidebar-title',
title_with_pretitle = 'sidebar-title-with-pretitle',
image = 'sidebar-image',
caption = 'sidebar-caption',
above = 'sidebar-above',
heading = 'sidebar-heading',
content = 'sidebar-content',
content_with_subgroup = 'sidebar-content-with-subgroup',
below = 'sidebar-below',
navbar = 'sidebar-navbar',
list = 'sidebar-list',
list_title = 'sidebar-list-title',
list_title_centered = 'sidebar-list-title-c',
list_content = 'sidebar-list-content'
}
}
}</text>
      <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Sidebar/styles.css</title>
    <ns>828</ns>
    <id>66235483</id>
    <revision>
      <id>1045330069</id>
      <parentid>1045150921</parentid>
      <timestamp>2021-09-20T01:15:45Z</timestamp>
      <contributor>
        <username>Goszei</username>
        <id>36510957</id>
      </contributor>
      <comment>self-rv, it's a little tight</comment>
      <model>sanitized-css</model>
      <format>text/css</format>
      <text bytes="3703" xml:space="preserve">/* {{pp-template}} */
/* TODO: Invert width design to be "mobile first" */
.sidebar {
/* TODO: Ask if we should have max-width 22em instead */
width: 22em;
/* @noflip */
float: right;
/* @noflip */
clear: right;
/* @noflip */
margin: 0.5em 0 1em 1em;
background: #f8f9fa;
border: 1px solid #aaa;
padding: 0.2em;
text-align: center;
line-height: 1.4em;
font-size: 88%;
border-collapse: collapse;
/* Timeless has display: none on .nomobile at mobile resolutions, so we
* unhide it with display: table and let precedence and proximity win.
*/
display: table;
}
/* Unfortunately, so does Minerva desktop, except Minerva drops an
* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on [[:phab:T111565]].)
*/
body.skin-minerva .sidebar {
display: table !important;
/* also, minerva is way too aggressive about other stylings on tables.
* TODO remove when this template gets moved to a div. plans on talk page.
* We always float right on Minerva because that's a lot of extra CSS
* otherwise. */
    float: right !important;
    margin: 0.5em 0 1em 1em !important;
}
.sidebar-subgroup {
width: 100%;
margin: 0;
border-spacing: 0;
}
.sidebar-left {
/* @noflip */
float: left;
/* @noflip */
clear: left;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-none {
float: none;
clear: both;
/* @noflip */
margin: 0.5em 1em 1em 0;
}
.sidebar-outer-title {
padding: 0 0.4em 0.2em;
font-size: 125%;
line-height: 1.2em;
font-weight: bold;
}
.sidebar-top-image {
padding: 0.4em;
}
.sidebar-top-caption,
.sidebar-pretitle-with-top-image,
.sidebar-caption {
padding: 0.2em 0.4em 0;
line-height: 1.2em;
}
.sidebar-pretitle {
padding: 0.4em 0.4em 0;
line-height: 1.2em;
}
.sidebar-title,
.sidebar-title-with-pretitle {
padding: 0.2em 0.8em;
font-size: 145%;
line-height: 1.2em;
}
.sidebar-title-with-pretitle {
padding: 0.1em 0.4em;
}
.sidebar-image {
padding: 0.2em 0.4em 0.4em;
}
.sidebar-heading {
padding: 0.1em 0.4em;
}
.sidebar-content {
padding: 0 0.5em 0.4em;
}
.sidebar-content-with-subgroup {
padding: 0.1em 0.4em 0.2em;
}
.sidebar-above,
.sidebar-below {
padding: 0.3em 0.8em;
font-weight: bold;
}
.sidebar-collapse .sidebar-above,
.sidebar-collapse .sidebar-below {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
.sidebar-navbar {
text-align: right;
font-size: 115%;
padding: 0 0.4em 0.4em;
}
.sidebar-list-title {
padding: 0 0.4em;
text-align: left;
font-weight: bold;
line-height: 1.6em;
font-size: 105%;
}
/* centered text with mw-collapsible headers is finicky */
.sidebar-list-title-c {
padding: 0 0.4em;
text-align: center;
margin: 0 3.3em;
}
@media (max-width: 720px) {
/* users have wide latitude to set arbitrary width and margin :(
  "Super-specific" selector to prevent overriding this appearance by
  lower level sidebars too */
body.mediawiki .sidebar {
width: 100% !important;
clear: both;
float: none !important; /* Remove when we div based; Minerva is dumb */
margin-left: 0 !important;
margin-right: 0 !important;
}
/* TODO: We might consider making all links wrap at small resolutions and then
* only introduce nowrap at higher resolutions. Do when we invert the media
* query.
*/
}</text>
      <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
    </revision>
  </page>
  <page>
    <title>Module:String</title>
    <ns>828</ns>
    <id>38569505</id>
    <revision>
      <id>970815276</id>
      <parentid>924313232</parentid>
      <timestamp>2020-08-02T15:49:42Z</timestamp>
      <contributor>
        <username>RexxS</username>
        <id>6112901</id>
      </contributor>
      <comment>separate annotations for str.match from those for str._match</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="18033" xml:space="preserve">--[[
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 &lt; 0 then
i = len + i + 1
end
if j &lt; 0 then
j = len + j + 1
end
if i &gt; len or j &gt; len or i &lt; 1 or j &lt; 1 then
return str._error( 'String subset index out of range' )
end
if j &lt; 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 {{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. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
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.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) &lt; 1 or math.abs(start) &gt; 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 &gt; 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index &gt; 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
--[[
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|match|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:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
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']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
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) &gt; 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 {{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 &gt;= "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
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
    pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
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 _, 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 = '&lt;strong class="error"&gt;String Module Error: ' .. error_str .. '&lt;/strong&gt;'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
    </revision>
  </page>
  <page>
    <title>Module:TableTools</title>
    <ns>828</ns>
    <id>41371028</id>
    <revision>
      <id>1048120640</id>
      <parentid>983044092</parentid>
      <timestamp>2021-10-04T10:40:18Z</timestamp>
      <contributor>
        <username>MSGJ</username>
        <id>42630</id>
      </contributor>
      <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by [[User:Alexiscoutinho]]</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------
--                                  TableTools                                  --
--                                                                                --
-- This module includes a number of functions for dealing with Lua tables.        --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke.                                              --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v &gt;= 1 and floor(v) == v and v &lt; infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and tostring(v) == '-nan'
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(t)
checkType('removeDuplicates', 1, t, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(t) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
else
if not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i &lt;= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" &lt; "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 &lt; type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) &lt; tostring(item2)
else
return item1 &lt; item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} -&gt;
-- {a = 1, b = 2, c = 3}.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local map = {}
for i, v in ipairs(arr) do
map[v] = i
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} -&gt;
-- {a = true, b = true, c = true}.
------------------------------------------------------------------------------------
function p.listToSet(t)
checkType("listToSet", 1, t, "table")
local set = {}
for _, item in ipairs(t) do
set[item] = true
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
-- Stores copies of tables indexed by the original table.
already_seen = already_seen or {}
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
if type(orig) == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
already_seen[orig] = copy
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
local mt_copy = _deepCopy(mt, includeMetatable, already_seen)
setmetatable(copy, mt_copy)
already_seen[mt] = mt_copy
end
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen)
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d}  =&gt;  "acd"
-- sparseConcat{nil, b, c, d}  =&gt;  "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of  the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if valueToFind is a member of the array, and false otherwise.
------------------------------------------------------------------------------------
function p.inArray(arr, valueToFind)
checkType("inArray", 1, arr, "table")
-- if valueToFind is nil, error?
for _, v in ipairs(arr) do
if v == valueToFind then
return true
end
end
return false
end
return p</text>
      <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Template link general</title>
    <ns>828</ns>
    <id>63673341</id>
    <revision>
      <id>1019778167</id>
      <parentid>1007971488</parentid>
      <timestamp>2021-04-25T10:37:43Z</timestamp>
      <contributor>
        <username>Primefac</username>
        <id>11508456</id>
      </contributor>
      <comment>implement sandbox fix for nowiki issues (TPER)</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg
local getArgs = require('Module:Arguments').getArgs
local p = {}
-- Is a string non-empty?
local function _ne(s)
return s ~= nil and s ~= ""
end
local nw = mw.text.nowiki
local function addTemplate(s)
local i, _ = s:find(':', 1, true)
if i == nil then
return 'Template:' .. s
end
local ns = s:sub(1, i - 1)
if ns == '' or mw.site.namespaces[ns] then
return s
else
return 'Template:' .. s
end
end
local function trimTemplate(s)
local needle = 'template:'
if s:sub(1, needle:len()):lower() == needle then
return s:sub(needle:len() + 1)
else
return s
end
end
local function linkTitle(args)
if _ne(args.nolink) then
return args['1']
end
local titleObj
local titlePart = '[['
if args['1'] then
-- This handles :Page and other NS
titleObj = mw.title.new(args['1'], 'Template')
else
titleObj = mw.title.getCurrentTitle()
end
titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or
addTemplate(args['1']))
local textPart = args.alttext
if not _ne(textPart) then
if titleObj ~= nil then
textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText
else
-- redlink
textPart = args['1']
end
end
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
end
if _ne(args.brace) then
textPart = nw('{{') .. textPart .. nw('}}')
elseif _ne(args.braceinside) then
textPart = nw('{') .. textPart .. nw('}')
end
titlePart = titlePart .. '|' .. textPart .. ']]'
if _ne(args.braceinside) then
titlePart = nw('{') .. titlePart .. nw('}')
end
return titlePart
end
function p.main(frame)
local args = getArgs(frame, {
trim = true,
removeBlanks = false
})
return p._main(args)
end
function p._main(args)
local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname)
local italic = _ne(args.italic) or _ne(args.italics)
local dontBrace = _ne(args.brace) or _ne(args.braceinside)
local code = _ne(args.code) or _ne(args.tt)
-- Build the link part
local titlePart = linkTitle(args)
if bold then titlePart = "'''" .. titlePart .. "'''" end
if _ne(args.nowrapname) then titlePart = '&lt;span class="nowrap"&gt;' .. titlePart .. '&lt;/span&gt;' end
-- Build the arguments
local textPart = ""
local textPartBuffer = ""
local i = 2
while args[i] do
local val = args[i]
textPartBuffer = textPartBuffer .. '&amp;#124;'
if val ~= "" then
if _ne(args.nowiki) then
-- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will
-- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up
val = nw(mw.text.unstripNoWiki(val))
end
if italic then val = '&lt;span style="font-style:italic;"&gt;' .. val .. '&lt;/span&gt;' end
textPart = textPart .. textPartBuffer .. val
textPartBuffer = ""
end
i = i+1
end
-- final wrap
local ret = titlePart .. textPart
if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end
if _ne(args.a) then ret = nw('*') .. '&amp;nbsp;' .. ret end
if _ne(args.kbd) then ret = '&lt;kbd&gt;' .. ret .. '&lt;/kbd&gt;' end
if code then
ret = '&lt;code&gt;' .. ret .. '&lt;/code&gt;'
elseif _ne(args.plaincode) then
ret = '&lt;code style="border:none;background:transparent;"&gt;' .. ret .. '&lt;/code&gt;'
end
if _ne(args.nowrap) then ret = '&lt;span class="nowrap"&gt;' .. ret .. '&lt;/span&gt;' end
--[[ Wrap as html??
local span = mw.html.create('span')
span:wikitext(ret)
--]]
if _ne(args.debug) then ret = ret .. '\n&lt;pre&gt;' .. mw.text.encode(mw.dumpObject(args)) .. '&lt;/pre&gt;' end
return ret
end
return p</text>
      <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Transclusion count</title>
    <ns>828</ns>
    <id>61792794</id>
    <revision>
      <id>1050945237</id>
      <parentid>1036845225</parentid>
      <timestamp>2021-10-20T19:51:20Z</timestamp>
      <contributor>
        <username>MusikBot II</username>
        <id>29539620</id>
      </contributor>
      <minor/>
      <comment>Changed protection settings for "[[Module:Transclusion count]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 3791 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="1484" xml:space="preserve">local p = {}
function p.fetch(frame)
local template = nil
local return_value = nil
-- Use demo parameter if it exists, otherswise use current template name
local namespace = mw.title.getCurrentTitle().namespace
if frame.args["demo"] and frame.args["demo"] ~= "" then
template = frame.args["demo"]
elseif namespace == 10 then -- Template namespace
template = mw.title.getCurrentTitle().text
elseif namespace == 828 then -- Module namespace
template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text)
end
-- If in template or module namespace, look up count in /data
if template ~= nil then
namespace = mw.title.new(template, "Template").namespace
if namespace == 10 or namespace == 828 then
template =  mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end
local index = mw.ustring.sub(mw.title.new(template).text,1,1)
local status, data = pcall(function ()
return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other")))
end)
if status then
return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")])
end
end
end
-- If database value doesn't exist, use value passed to template
if return_value == nil and frame.args[1] ~= nil then
local arg1=mw.ustring.match(frame.args[1], '[%d,]+')
if arg1 and arg1 ~= '' then
return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R'))
end
end
return return_value
end
return p</text>
      <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Transclusion count/data/I</title>
    <ns>828</ns>
    <id>61481780</id>
    <revision>
      <id>1050327856</id>
      <parentid>1049151757</parentid>
      <timestamp>2021-10-17T05:16:15Z</timestamp>
      <contributor>
        <username>Ahechtbot</username>
        <id>26109785</id>
      </contributor>
      <minor/>
      <comment>[[Wikipedia:BOT|Bot]]: Updated page.</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="22449" xml:space="preserve">return {
["IAAF_name"] = 2300,
["IAST"] = 5700,
["IBDB_name"] = 8700,
["ICD10"] = 4600,
["ICD9"] = 4400,
["ICS"] = 2600,
["IDN"] = 3000,
["IMDB_name"] = 2600,
["IMDB_title"] = 3300,
["IMDb_episode"] = 8400,
["IMDb_name"] = 143000,
["IMDb_title"] = 177000,
["IMO_Number"] = 3800,
["IMSLP"] = 7600,
["IND"] = 7300,
["INR"] = 5400,
["INRConvert"] = 5000,
["INRConvert/CurrentRate"] = 5000,
["INRConvert/USD"] = 5000,
["INRConvert/out"] = 5000,
["IOC_profile"] = 7300,
["IP"] = 2400,
["IPA"] = 116000,
["IPA-all"] = 3100,
["IPA-de"] = 6800,
["IPA-es"] = 7400,
["IPA-fr"] = 26000,
["IPA-it"] = 5500,
["IPA-nl"] = 3200,
["IPA-pl"] = 3800,
["IPA-pt"] = 3500,
["IPA-ru"] = 2500,
["IPA-sh"] = 2900,
["IPA-sl"] = 6700,
["IPA-th"] = 2700,
["IPA_audio_link"] = 14000,
["IPA_link"] = 2200,
["IPAc-cmn"] = 2400,
["IPAc-en"] = 43000,
["IPAc-pl"] = 52000,
["IPC_athlete"] = 2300,
["IPSummary"] = 76000,
["IP_summary"] = 76000,
["IPsock"] = 31000,
["IPtalk"] = 27000,
["IPuser"] = 6800,
["IPvandal"] = 13000,
["IRC"] = 10000,
["IRL"] = 5200,
["IRN"] = 3300,
["ISBN"] = 454000,
["ISBNT"] = 35000,
["ISO_15924/script-example-character"] = 2500,
["ISO_15924/wp-article"] = 2600,
["ISO_15924/wp-article/format"] = 2600,
["ISO_15924/wp-article/label"] = 2500,
["ISO_3166_code"] = 215000,
["ISO_3166_name"] = 16000,
["ISO_639_name"] = 5900,
["ISP"] = 21000,
["ISP_test"] = 5600,
["ISR"] = 4300,
["ISSN"] = 11000,
["ISSN_link"] = 29000,
["ISTAT"] = 8100,
["ISU_figure_skater"] = 2400,
["ITA"] = 16000,
["ITF"] = 5400,
["ITF_profile"] = 7700,
["ITIS"] = 4100,
["ITN_talk"] = 8100,
["ITN_talk/date"] = 8100,
["IUCN_banner"] = 14000,
["I_sup"] = 4200,
["Iaaf_name"] = 7700,
["Ice_hockey"] = 20000,
["Ice_hockey_stats"] = 14000,
["Icehockeystats"] = 11000,
["Icon"] = 524000,
["If"] = 137000,
["If_all"] = 7800,
["If_between"] = 3600,
["If_both"] = 8610000,
["If_either"] = 4900,
["If_empty"] = 2540000,
["If_first_display_both"] = 58000,
["If_in_page"] = 7100,
["If_last_display_both"] = 26000,
["If_preview"] = 54000,
["If_then_show"] = 204000,
["Ifempty"] = 3500,
["Ifeq"] = 2200,
["Ifexist_not_redirect"] = 431000,
["Ifnotempty"] = 14000,
["Ifnumber"] = 21000,
["Ifor"] = 611000,
["Ifsubst"] = 50000,
["Ih"] = 7300,
["Ill"] = 78000,
["Illm"] = 6400,
["Image_frame"] = 2800,
["Image_label"] = 4300,
["Image_label_begin"] = 3600,
["Image_label_end"] = 3200,
["Image_label_small"] = 2500,
["Image_needed"] = 4300,
["Image_other"] = 320000,
["Image_requested"] = 165000,
["Image_requested/Category_helper"] = 159000,
["Imbox"] = 904000,
["Imdb_name"] = 7500,
["Imdb_title"] = 14000,
["Importance"] = 5290000,
["Importance/colour"] = 5300000,
["Importance_mask"] = 8290000,
["Improve_categories"] = 5400,
["In_class"] = 4500,
["In_lang"] = 337000,
["In_string"] = 55000,
["In_title"] = 15000,
["Inactive_WikiProject_banner"] = 167000,
["Inactive_userpage_blanked"] = 4500,
["Include-USGov"] = 30000,
["Incomplete_list"] = 20000,
["Increase"] = 36000,
["Incumbent_pope"] = 4300,
["Independent/meta/color"] = 4500,
["Independent_(US)/meta/color"] = 2600,
["Independent_(politician)/meta/color"] = 13000,
["Independent_(politician)/meta/shortname"] = 11000,
["Independent_politician/meta/color"] = 20000,
["Independent_politician/meta/shortname"] = 16000,
["IndexFungorum"] = 2200,
["Indian_English"] = 3800,
["Indian_National_Congress/meta/color"] = 4500,
["Indian_National_Congress/meta/shortname"] = 3300,
["Indian_Rupee"] = 9000,
["Indian_railway_code"] = 3100,
["Inflation"] = 15000,
["Inflation-fn"] = 4900,
["Inflation-year"] = 3800,
["Inflation/IN/startyear"] = 5000,
["Inflation/UK"] = 3700,
["Inflation/UK/dataset"] = 3700,
["Inflation/UK/startyear"] = 3700,
["Inflation/US"] = 9200,
["Inflation/US/dataset"] = 9200,
["Inflation/US/startyear"] = 9200,
["Inflation/fn"] = 5300,
["Inflation/year"] = 19000,
["Info"] = 7800,
["Infobox"] = 3530000,
["Infobox/mobileviewfix.css"] = 3900,
["Infobox3cols"] = 276000,
["Infobox_AFL_biography"] = 14000,
["Infobox_Aircraft_Begin"] = 7900,
["Infobox_Aircraft_Type"] = 7100,
["Infobox_Athletics_Championships"] = 2400,
["Infobox_Australian_place"] = 15000,
["Infobox_CFL_biography"] = 6000,
["Infobox_CFL_biography/position"] = 5900,
["Infobox_COA_wide"] = 2500,
["Infobox_Canada_electoral_district"] = 2400,
["Infobox_Chinese"] = 17000,
["Infobox_Chinese/Footer"] = 8700,
["Infobox_Chinese/Header"] = 8700,
["Infobox_Chinese/Korean"] = 14000,
["Infobox_Christian_leader"] = 16000,
["Infobox_Congressman"] = 2000,
["Infobox_Election"] = 3200,
["Infobox_French_commune"] = 37000,
["Infobox_GAA_player"] = 3400,
["Infobox_Gaelic_Athletic_Association_player"] = 4600,
["Infobox_German_location"] = 13000,
["Infobox_German_place"] = 14000,
["Infobox_Greece_place"] = 2700,
["Infobox_Greek_Dimos"] = 2700,
["Infobox_Hindu_temple"] = 2000,
["Infobox_Italian_comune"] = 8100,
["Infobox_Korean_name"] = 14000,
["Infobox_Korean_name/categories"] = 14000,
["Infobox_MLB_yearly"] = 3000,
["Infobox_NCAA_team_season"] = 22000,
["Infobox_NFL_biography"] = 26000,
["Infobox_NFL_player"] = 10000,
["Infobox_NFL_season"] = 2800,
["Infobox_NFL_team_season"] = 3800,
["Infobox_NRHP"] = 71000,
["Infobox_NRHP/conv"] = 17000,
["Infobox_NRHP/locmapin2region"] = 65000,
["Infobox_Newspaper"] = 2600,
["Infobox_Officeholder"] = 9100,
["Infobox_Olympic_event"] = 7000,
["Infobox_Olympic_event/games_text"] = 7000,
["Infobox_Organization"] = 2400,
["Infobox_Paralympic_event"] = 2500,
["Infobox_Paralympic_event/games_text"] = 2500,
["Infobox_Person"] = 2500,
["Infobox_Politician"] = 4400,
["Infobox_Romania_subdivision"] = 3100,
["Infobox_Romanian_subdivision"] = 3100,
["Infobox_Russian_district"] = 2000,
["Infobox_Russian_inhabited_locality"] = 3700,
["Infobox_SCOTUS_case"] = 3500,
["Infobox_SSSI"] = 2000,
["Infobox_Site_of_Special_Scientific_Interest"] = 2100,
["Infobox_Software"] = 2300,
["Infobox_State_Representative"] = 2200,
["Infobox_Swiss_town"] = 2800,
["Infobox_Switzerland_municipality"] = 2800,
["Infobox_U.S._county"] = 3000,
["Infobox_U.S._county/district"] = 3000,
["Infobox_UK_legislation"] = 2100,
["Infobox_UK_place"] = 25000,
["Infobox_UK_place/NoDialCode"] = 7600,
["Infobox_UK_place/NoPostCode"] = 2700,
["Infobox_UK_place/area"] = 2200,
["Infobox_UK_place/dist"] = 2400,
["Infobox_UK_place/local"] = 25000,
["Infobox_UK_place/styles.css"] = 25000,
["Infobox_UN_resolution"] = 2200,
["Infobox_US_Supreme_Court_case"] = 3600,
["Infobox_US_Supreme_Court_case/courts"] = 3600,
["Infobox_Vidhan_Sabha_constituency"] = 2500,
["Infobox_Wikipedia_user"] = 8400,
["Infobox_YouTube_personality"] = 2100,
["Infobox_academic"] = 9600,
["Infobox_aircraft_begin"] = 14000,
["Infobox_aircraft_occurrence"] = 2100,
["Infobox_aircraft_type"] = 13000,
["Infobox_airline"] = 4500,
["Infobox_airport"] = 16000,
["Infobox_airport/datatable"] = 15000,
["Infobox_album"] = 157000,
["Infobox_album/color"] = 181000,
["Infobox_album/link"] = 157000,
["Infobox_anatomy"] = 4400,
["Infobox_ancient_site"] = 4500,
["Infobox_animanga/Footer"] = 6100,
["Infobox_animanga/Header"] = 6100,
["Infobox_animanga/Print"] = 4800,
["Infobox_animanga/Video"] = 4300,
["Infobox_architect"] = 3200,
["Infobox_artist"] = 25000,
["Infobox_artist_discography"] = 5500,
["Infobox_artwork"] = 9700,
["Infobox_athlete"] = 4200,
["Infobox_attraction/status"] = 2800,
["Infobox_automobile"] = 7800,
["Infobox_award"] = 11000,
["Infobox_badminton_player"] = 2800,
["Infobox_baseball_biography"] = 27000,
["Infobox_baseball_biography/style"] = 27000,
["Infobox_baseball_biography/styles.css"] = 27000,
["Infobox_basketball_biography"] = 19000,
["Infobox_basketball_biography/style"] = 19000,
["Infobox_basketball_club"] = 2900,
["Infobox_beauty_pageant"] = 2100,
["Infobox_bilateral_relations"] = 4100,
["Infobox_body_of_water"] = 17000,
["Infobox_book"] = 48000,
["Infobox_boxer"] = 5300,
["Infobox_bridge"] = 5600,
["Infobox_building"] = 24000,
["Infobox_character"] = 7600,
["Infobox_chess_biography"] = 3100,
["Infobox_chess_player"] = 2800,
["Infobox_church"] = 13000,
["Infobox_church/denomination"] = 13000,
["Infobox_church/font_color"] = 13000,
["Infobox_civilian_attack"] = 4400,
["Infobox_college_coach"] = 11000,
["Infobox_college_sports_team_season"] = 34000,
["Infobox_college_sports_team_season/link"] = 34000,
["Infobox_college_sports_team_season/name"] = 34000,
["Infobox_college_sports_team_season/succession"] = 34000,
["Infobox_college_sports_team_season/team"] = 34000,
["Infobox_comic_book_title"] = 2800,
["Infobox_comics_character"] = 3700,
["Infobox_comics_creator"] = 3400,
["Infobox_company"] = 79000,
["Infobox_concert"] = 3000,
["Infobox_constituency"] = 4800,
["Infobox_country"] = 5600,
["Infobox_country/formernext"] = 5400,
["Infobox_country/imagetable"] = 4600,
["Infobox_country/multirow"] = 7400,
["Infobox_country/status_text"] = 2500,
["Infobox_country/styles.css"] = 5600,
["Infobox_country_at_games"] = 13000,
["Infobox_country_at_games/core"] = 13000,
["Infobox_country_at_games/see_also"] = 8500,
["Infobox_court_case"] = 4300,
["Infobox_court_case/images"] = 4300,
["Infobox_cricket_tournament"] = 2000,
["Infobox_cricketer"] = 31000,
["Infobox_cricketer/career"] = 31000,
["Infobox_cricketer/national_side"] = 7400,
["Infobox_criminal"] = 4800,
["Infobox_cultivar"] = 2300,
["Infobox_curler"] = 2400,
["Infobox_cycling_race_report"] = 4200,
["Infobox_cyclist"] = 16000,
["Infobox_dam"] = 4100,
["Infobox_designation_list"] = 17000,
["Infobox_designation_list/entry"] = 15000,
["Infobox_dim"] = 6200,
["Infobox_dim/core"] = 6200,
["Infobox_diocese"] = 3800,
["Infobox_drug"] = 8600,
["Infobox_drug/chemical_formula"] = 8600,
["Infobox_drug/formatATC"] = 8500,
["Infobox_drug/formatCASnumber"] = 8600,
["Infobox_drug/formatChEBI"] = 8600,
["Infobox_drug/formatChEMBL"] = 8600,
["Infobox_drug/formatChemDBNIAID"] = 8600,
["Infobox_drug/formatChemSpider"] = 8600,
["Infobox_drug/formatCompTox"] = 8600,
["Infobox_drug/formatDrugBank"] = 8600,
["Infobox_drug/formatIUPHARBPS"] = 8600,
["Infobox_drug/formatJmol"] = 8600,
["Infobox_drug/formatKEGG"] = 8600,
["Infobox_drug/formatPDBligand"] = 8000,
["Infobox_drug/formatPubChemCID"] = 8600,
["Infobox_drug/formatPubChemSID"] = 8600,
["Infobox_drug/formatUNII"] = 8600,
["Infobox_drug/legal_status"] = 8700,
["Infobox_drug/licence"] = 8600,
["Infobox_drug/maintenance_categories"] = 8600,
["Infobox_drug/pregnancy_category"] = 8600,
["Infobox_drug/title"] = 8600,
["Infobox_election"] = 25000,
["Infobox_election/row"] = 25000,
["Infobox_election/shortname"] = 23000,
["Infobox_enzyme"] = 5100,
["Infobox_ethnic_group"] = 6700,
["Infobox_event"] = 4000,
["Infobox_figure_skater"] = 4000,
["Infobox_film"] = 147000,
["Infobox_film/short_description"] = 147000,
["Infobox_film_awards"] = 2300,
["Infobox_film_awards/link"] = 2300,
["Infobox_film_awards/style"] = 2300,
["Infobox_food"] = 6400,
["Infobox_football_biography"] = 194000,
["Infobox_football_club"] = 25000,
["Infobox_football_club_season"] = 17000,
["Infobox_football_league"] = 2400,
["Infobox_football_league_season"] = 17000,
["Infobox_football_match"] = 5200,
["Infobox_football_tournament_season"] = 6300,
["Infobox_former_subdivision"] = 3000,
["Infobox_former_subdivision/styles.css"] = 3000,
["Infobox_game"] = 2200,
["Infobox_game_score"] = 3200,
["Infobox_gene"] = 13000,
["Infobox_given_name"] = 3800,
["Infobox_golfer"] = 4100,
["Infobox_golfer/highest_ranking"] = 4100,
["Infobox_government_agency"] = 9200,
["Infobox_gridiron_football_person"] = 3400,
["Infobox_gridiron_football_person/position"] = 5900,
["Infobox_gymnast"] = 3000,
["Infobox_handball_biography"] = 4600,
["Infobox_historic_site"] = 9800,
["Infobox_horseraces"] = 2500,
["Infobox_hospital"] = 5900,
["Infobox_hospital/care_system"] = 5900,
["Infobox_hospital/lists"] = 5900,
["Infobox_ice_hockey_player"] = 19000,
["Infobox_information_appliance"] = 2100,
["Infobox_international_football_competition"] = 5200,
["Infobox_islands"] = 8300,
["Infobox_islands/area"] = 8700,
["Infobox_islands/density"] = 8700,
["Infobox_islands/length"] = 8300,
["Infobox_islands/styles.css"] = 8300,
["Infobox_journal"] = 9300,
["Infobox_journal/Abbreviation_search"] = 9200,
["Infobox_journal/Bluebook_check"] = 9000,
["Infobox_journal/Former_check"] = 9000,
["Infobox_journal/ISO_4_check"] = 9000,
["Infobox_journal/ISSN-eISSN"] = 9000,
["Infobox_journal/Indexing_search"] = 9100,
["Infobox_journal/MathSciNet_check"] = 9000,
["Infobox_journal/NLM_check"] = 9000,
["Infobox_journal/frequency"] = 8200,
["Infobox_judge"] = 2700,
["Infobox_lake"] = 5000,
["Infobox_language"] = 9200,
["Infobox_language/family-color"] = 11000,
["Infobox_language/genetic"] = 6400,
["Infobox_language/linguistlist"] = 9200,
["Infobox_language/ref"] = 6900,
["Infobox_legislature"] = 3100,
["Infobox_lighthouse"] = 2600,
["Infobox_lighthouse/ARLHS"] = 2600,
["Infobox_lighthouse/NGA"] = 2600,
["Infobox_lighthouse/light"] = 2600,
["Infobox_locomotive"] = 4300,
["Infobox_magazine"] = 7000,
["Infobox_manner_of_address"] = 3000,
["Infobox_mapframe"] = 81000,
["Infobox_martial_artist"] = 5300,
["Infobox_martial_artist/record"] = 5300,
["Infobox_medal_templates"] = 397000,
["Infobox_medical_condition"] = 9200,
["Infobox_medical_condition_(new)"] = 8000,
["Infobox_military_conflict"] = 19000,
["Infobox_military_installation"] = 8900,
["Infobox_military_person"] = 41000,
["Infobox_military_structure"] = 2100,
["Infobox_military_unit"] = 24000,
["Infobox_mine"] = 2000,
["Infobox_model"] = 2300,
["Infobox_monarch"] = 2000,
["Infobox_mountain"] = 26000,
["Infobox_museum"] = 9200,
["Infobox_musical_artist"] = 116000,
["Infobox_musical_artist/color"] = 116000,
["Infobox_musical_artist/hCard_class"] = 297000,
["Infobox_musical_artist/tracking"] = 104000,
["Infobox_musical_composition"] = 2400,
["Infobox_name"] = 6900,
["Infobox_name_module"] = 10000,
["Infobox_newspaper"] = 9000,
["Infobox_nobility"] = 3000,
["Infobox_noble"] = 6600,
["Infobox_officeholder"] = 186000,
["Infobox_officeholder/office"] = 190000,
["Infobox_official_post"] = 6800,
["Infobox_organization"] = 33000,
["Infobox_pageant_titleholder"] = 2700,
["Infobox_park"] = 6600,
["Infobox_person"] = 420000,
["Infobox_person/Wikidata"] = 3600,
["Infobox_person/height"] = 107000,
["Infobox_person/length"] = 6700,
["Infobox_person/weight"] = 73000,
["Infobox_philosopher"] = 3000,
["Infobox_planet"] = 4600,
["Infobox_play"] = 3500,
["Infobox_political_party"] = 13000,
["Infobox_power_station"] = 2800,
["Infobox_prepared_food"] = 3800,
["Infobox_professional_wrestler"] = 3900,
["Infobox_professional_wrestling_event"] = 2300,
["Infobox_protected_area"] = 13000,
["Infobox_protein_family"] = 2100,
["Infobox_publisher"] = 2300,
["Infobox_racehorse"] = 5300,
["Infobox_racing_driver"] = 3200,
["Infobox_radio_station"] = 22000,
["Infobox_rail"] = 2700,
["Infobox_rail_line"] = 6700,
["Infobox_rail_line/tracking"] = 6700,
["Infobox_rail_service"] = 2700,
["Infobox_reality_competition_season"] = 2900,
["Infobox_record_label"] = 3900,
["Infobox_recurring_event"] = 5700,
["Infobox_religious_biography"] = 4400,
["Infobox_religious_building"] = 11000,
["Infobox_religious_building/color"] = 15000,
["Infobox_requested"] = 2600,
["Infobox_river"] = 29000,
["Infobox_river/calcunit"] = 29000,
["Infobox_river/discharge"] = 29000,
["Infobox_river/row-style"] = 29000,
["Infobox_river/source"] = 29000,
["Infobox_road"] = 24000,
["Infobox_road/banner"] = 13000,
["Infobox_road/browselinks/USA"] = 13000,
["Infobox_road/hide/cities"] = 2100,
["Infobox_road/maint/USA"] = 13000,
["Infobox_road/meta/colors"] = 2300,
["Infobox_road/meta/errors"] = 24000,
["Infobox_road/meta/mask/category"] = 23000,
["Infobox_road/meta/mask/country"] = 24000,
["Infobox_road/meta/mask/subtype1"] = 13000,
["Infobox_road/meta/mask/subtype2"] = 12000,
["Infobox_road/name/USA"] = 13000,
["Infobox_road/name/USA/StateName"] = 6300,
["Infobox_road/shield/USA"] = 13000,
["Infobox_road/shieldmain/USA"] = 13000,
["Infobox_road_small"] = 2200,
["Infobox_rockunit"] = 6300,
["Infobox_royalty"] = 19000,
["Infobox_royalty/short_description"] = 19000,
["Infobox_rugby_biography"] = 14000,
["Infobox_rugby_biography/correct_date"] = 14000,
["Infobox_rugby_biography/depcheck"] = 6700,
["Infobox_rugby_league_biography"] = 9400,
["Infobox_rugby_league_biography/PLAYER"] = 9300,
["Infobox_rugby_team"] = 2500,
["Infobox_saint"] = 4600,
["Infobox_school"] = 39000,
["Infobox_school/short_description"] = 39000,
["Infobox_school_district"] = 3800,
["Infobox_school_district/styles.css"] = 3000,
["Infobox_scientist"] = 43000,
["Infobox_service_record"] = 2500,
["Infobox_settlement"] = 540000,
["Infobox_settlement/areadisp"] = 219000,
["Infobox_settlement/columns"] = 87000,
["Infobox_settlement/columns/styles.css"] = 87000,
["Infobox_settlement/densdisp"] = 407000,
["Infobox_settlement/impus"] = 78000,
["Infobox_settlement/lengthdisp"] = 160000,
["Infobox_settlement/link"] = 87000,
["Infobox_settlement/metric"] = 196000,
["Infobox_settlement/pref"] = 273000,
["Infobox_settlement/styles.css"] = 532000,
["Infobox_ship_begin"] = 39000,
["Infobox_ship_career"] = 35000,
["Infobox_ship_characteristics"] = 39000,
["Infobox_ship_class_overview"] = 3800,
["Infobox_ship_image"] = 38000,
["Infobox_shopping_mall"] = 3300,
["Infobox_short_story"] = 2100,
["Infobox_skier"] = 2500,
["Infobox_soap_character"] = 3000,
["Infobox_software"] = 14000,
["Infobox_software/simple"] = 14000,
["Infobox_song"] = 71000,
["Infobox_song/color"] = 71000,
["Infobox_song/link"] = 71000,
["Infobox_spaceflight"] = 3400,
["Infobox_speed_skater"] = 2500,
["Infobox_sports_competition_event"] = 13000,
["Infobox_sports_competition_event/medalrow"] = 8500,
["Infobox_sports_league"] = 3600,
["Infobox_sports_season"] = 4400,
["Infobox_sports_team"] = 2100,
["Infobox_sportsperson"] = 103000,
["Infobox_stadium"] = 4600,
["Infobox_state_representative"] = 2700,
["Infobox_station"] = 52000,
["Infobox_station/doc"] = 52000,
["Infobox_station/services"] = 52000,
["Infobox_station/styles.css"] = 52000,
["Infobox_street"] = 2900,
["Infobox_swimmer"] = 9200,
["Infobox_television"] = 53000,
["Infobox_television_channel"] = 6200,
["Infobox_television_episode"] = 11000,
["Infobox_television_season"] = 8500,
["Infobox_television_station"] = 3700,
["Infobox_tennis_biography"] = 8700,
["Infobox_tennis_tournament_event"] = 16000,
["Infobox_tennis_tournament_year"] = 8200,
["Infobox_tennis_tournament_year/color"] = 24000,
["Infobox_tennis_tournament_year/footer"] = 24000,
["Infobox_train"] = 2100,
["Infobox_tropical_cyclone"] = 2200,
["Infobox_union"] = 2200,
["Infobox_university"] = 26000,
["Infobox_user"] = 2600,
["Infobox_venue"] = 17000,
["Infobox_video_game"] = 26000,
["Infobox_volleyball_biography"] = 5100,
["Infobox_weapon"] = 7000,
["Infobox_website"] = 7500,
["Infobox_writer"] = 35000,
["Information"] = 119000,
["Inline"] = 2300,
["Inprogress"] = 2100,
["Input_link"] = 33000,
["Inputbox"] = 12000,
["Instagram"] = 8000,
["Interlanguage_link"] = 112000,
["Interlanguage_link_multi"] = 21000,
["Internet_Archive_author"] = 18000,
["Internet_Archive_film"] = 2300,
["Intitle"] = 9300,
["Invalid_SVG"] = 4200,
["Invalid_SVG/styles.css"] = 4200,
["Ipsock"] = 13000,
["Iptalk"] = 22000,
["IranCensus2006"] = 55000,
["IranNCSGN"] = 3300,
["Iran_Census_2006"] = 55000,
["Irc"] = 2100,
["Irish_place_name"] = 2400,
["IsValidPageName"] = 117000,
["Is_article"] = 4000,
["Is_country_in_Central_America"] = 12000,
["Is_country_in_the_Caribbean"] = 13000,
["Is_empty"] = 4300,
["Is_interwiki_link"] = 5900,
["Is_italic_taxon"] = 374000,
["Isbn"] = 5000,
["Isfdb_name"] = 3900,
["Isfdb_title"] = 4400,
["Isnumeric"] = 184000,
["Iso2continent"] = 24000,
["Iso2country"] = 21000,
["Iso2country/article"] = 21000,
["Iso2country/data"] = 21000,
["Iso2nationality"] = 68000,
["Issubst"] = 79000,
["Isu_name"] = 2200,
["Italic_dab2"] = 4900,
["Italic_title"] = 770000,
["Italic_title_prefixed"] = 8200,
["Italics_colon"] = 2900,
["Italictitle"] = 5100,
["Ivm"] = 5700,
["Ivm/styles.css"] = 5700,
["Ivmbox"] = 114000,
["Ivory_messagebox"] = 114000,
["Module:I18n/complex_date"] = 63000,
["Module:IP"] = 76000,
["Module:IPA_symbol"] = 3400,
["Module:IPA_symbol/data"] = 3400,
["Module:IPAc-en"] = 43000,
["Module:IPAc-en/data"] = 43000,
["Module:IPAc-en/phonemes"] = 43000,
["Module:IPAc-en/pronunciation"] = 43000,
["Module:IPAddress"] = 99000,
["Module:ISO_3166"] = 689000,
["Module:ISO_3166/data/AT"] = 2500,
["Module:ISO_3166/data/BA"] = 3300,
["Module:ISO_3166/data/CA"] = 2500,
["Module:ISO_3166/data/DE"] = 14000,
["Module:ISO_3166/data/ES"] = 2900,
["Module:ISO_3166/data/FR"] = 38000,
["Module:ISO_3166/data/GB"] = 5800,
["Module:ISO_3166/data/GR"] = 2900,
["Module:ISO_3166/data/IN"] = 26000,
["Module:ISO_3166/data/National"] = 689000,
["Module:ISO_3166/data/RS"] = 3200,
["Module:ISO_3166/data/RU"] = 24000,
["Module:ISO_3166/data/TR"] = 2100,
["Module:ISO_3166/data/US"] = 80000,
["Module:ISO_639_name"] = 13000,
["Module:ISOdate"] = 63000,
["Module:Icon"] = 524000,
["Module:Icon/data"] = 524000,
["Module:If_empty"] = 2540000,
["Module:If_in_page"] = 7100,
["Module:If_preview"] = 427000,
["Module:If_preview/configuration"] = 427000,
["Module:If_preview/styles.css"] = 427000,
["Module:In_lang"] = 337000,
["Module:Infobox"] = 3790000,
["Module:Infobox/dates"] = 62000,
["Module:Infobox/styles.css"] = 1800000,
["Module:Infobox3cols"] = 289000,
["Module:InfoboxImage"] = 4050000,
["Module:Infobox_body_of_water_tracking"] = 17000,
["Module:Infobox_cyclist_tracking"] = 16000,
["Module:Infobox_film/track"] = 147000,
["Module:Infobox_gene"] = 13000,
["Module:Infobox_mapframe"] = 341000,
["Module:Infobox_military_conflict"] = 19000,
["Module:Infobox_military_conflict/styles.css"] = 19000,
["Module:Infobox_multi-lingual_name"] = 17000,
["Module:Infobox_multi-lingual_name/data"] = 17000,
["Module:Infobox_power_station"] = 2800,
["Module:Infobox_road"] = 26000,
["Module:Infobox_road/color"] = 24000,
["Module:Infobox_road/length"] = 24000,
["Module:Infobox_road/locations"] = 24000,
["Module:Infobox_road/map"] = 24000,
["Module:Infobox_road/meta/mask/country"] = 15000,
["Module:Infobox_road/route"] = 2200,
["Module:Infobox_television"] = 51000,
["Module:Infobox_television_disambiguation_check"] = 59000,
["Module:Infobox_television_episode"] = 11000,
["Module:Infobox_television_season_disambiguation_check"] = 8100,
["Module:Infobox_television_season_name"] = 8600,
["Module:Internet_Archive"] = 18000,
["Module:IrelandByCountyCatNav"] = 2500,
["Module:Is_infobox_in_lead"] = 345000,
["Module:Italic_title"] = 1040000,
["Module:Italic_title2"] = 4900,
}</text>
      <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Yesno</title>
    <ns>828</ns>
    <id>38665046</id>
    <revision>
      <id>948473803</id>
      <parentid>948472535</parentid>
      <timestamp>2020-04-01T06:27:55Z</timestamp>
      <contributor>
        <username>MusikAnimal</username>
        <id>14882394</id>
      </contributor>
      <comment>Undid revision 948472533 by [[Special:Contributions/w&gt;Vogone|w&gt;Vogone]] ([[User talk:w&gt;Vogone|talk]])</comment>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{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 val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end</text>
      <sha1>swdskn7svew8i9wuydn9uj5l3r2ghcs</sha1>
     </revision>
     </revision>
   </page>
   </page>
</mediawiki>
</mediawiki>

Revision as of 20:40, 21 October 2021

<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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Category:Script error: No such module "string".<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> <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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Infobox<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> Template loop detected: Template:Infobox </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below {{{title}}} and {{{above}}}, but before images.

Examples:

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template loop detected: Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template loop detected: Template:Infobox</nowiki></code>.

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

or,

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>Script error: No such module "Lua banner".</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>Script error: No such module "Parameter names example".</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">Script error: No such module "Sidebar".<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header"><!--
+header:

-->This is the <!--

 +header,  +link TD; DEFAULT:

-->TemplateData<!--

  e.o. #if:nolink; DEFAULT:

--> for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage<!--

  e.o. #if:noheader

-->

TemplateData for Infobox </div><includeonly><!--

check parameters

-->Script error: No such module "Check for unknown parameters".<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">Script error: No such module "Template link general".<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>Script error: No such module "Template link general".</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">click here to see a monthly parameter usage report for this template.<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although, per WP:Manual of Style/Infoboxes, all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "40" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the | magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("40") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template loop detected: Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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: -- -- Script error: No such module "Protection banner". -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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: Script error: No such module "String". OR Script error: No such module "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: Script error: No such module "String". OR Script error: No such module "String".

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: Script error: No such module "String".

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: Script error: No such module "String". ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki> </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below {{{title}}} and {{{above}}}, but before images.

Examples:

<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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Infobox/doc<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> Template loop detected: Template:Infobox </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Text in caption over infobox and {{{above}}}, but before images.

Examples:

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template loop detected: Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template loop detected: Template:Infobox</nowiki></code>.

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

or,

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>Script error: No such module "Lua banner".</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>Script error: No such module "Parameter names example".</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">Script error: No such module "Sidebar".<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header"><!--
+header:

-->This is the <!--

 +header,  +link TD; DEFAULT:

-->TemplateData<!--

  e.o. #if:nolink; DEFAULT:

--> for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage<!--

  e.o. #if:noheader

-->

TemplateData for Infobox </div><includeonly><!--

check parameters

-->Script error: No such module "Check for unknown parameters".<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">Script error: No such module "Template link general".<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>Script error: No such module "Template link general".</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">click here to see a monthly parameter usage report for this template.<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although, per WP:Manual of Style/Infoboxes, all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "40" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the | magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("40") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template loop detected: Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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: -- -- Script error: No such module "Protection banner". -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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: Script error: No such module "String". OR Script error: No such module "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: Script error: No such module "String". OR Script error: No such module "String".

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: Script error: No such module "String".

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: Script error: No such module "String". ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki> <pre style="overflow:auto"> <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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Infobox<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> Template loop detected: Template:Infobox </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Text in caption over infobox and {{{above}}}, but before images.

Examples:

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template loop detected: Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template loop detected: Template:Infobox</nowiki></code>.

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

or,

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>Script error: No such module "Lua banner".</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>Script error: No such module "Parameter names example".</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">Script error: No such module "Sidebar".<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header"><!--
+header:

-->This is the <!--

 +header,  +link TD; DEFAULT:

-->TemplateData<!--

  e.o. #if:nolink; DEFAULT:

--> for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage<!--

  e.o. #if:noheader

-->

TemplateData for Infobox </div><includeonly><!--

check parameters

-->Script error: No such module "Check for unknown parameters".<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">Script error: No such module "Template link general".<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>Script error: No such module "Template link general".</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">click here to see a monthly parameter usage report for this template.<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although, per WP:Manual of Style/Infoboxes, all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "40" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the | magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("40") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template loop detected: Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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: -- -- Script error: No such module "Protection banner". -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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: Script error: No such module "String". OR Script error: No such module "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: Script error: No such module "String". OR Script error: No such module "String".

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: Script error: No such module "String".

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: Script error: No such module "String". ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki> </pre>Template:Clear

<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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Infobox/doc<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> Template loop detected: Template:Infobox </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below {{{title}}} and Text in uppermost cell of infobox, but before images.

Examples:

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template loop detected: Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template loop detected: Template:Infobox</nowiki></code>.

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

or,

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>Script error: No such module "Lua banner".</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>Script error: No such module "Parameter names example".</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">Script error: No such module "Sidebar".<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header"><!--
+header:

-->This is the <!--

 +header,  +link TD; DEFAULT:

-->TemplateData<!--

  e.o. #if:nolink; DEFAULT:

--> for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage<!--

  e.o. #if:noheader

-->

TemplateData for Infobox </div><includeonly><!--

check parameters

-->Script error: No such module "Check for unknown parameters".<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">Script error: No such module "Template link general".<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>Script error: No such module "Template link general".</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">click here to see a monthly parameter usage report for this template.<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although, per WP:Manual of Style/Infoboxes, all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "40" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the | magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("40") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template loop detected: Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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: -- -- Script error: No such module "Protection banner". -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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: Script error: No such module "String". OR Script error: No such module "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: Script error: No such module "String". OR Script error: No such module "String".

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: Script error: No such module "String".

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: Script error: No such module "String". ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki> <pre style="overflow:auto"> <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>https://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.38.0-wmf.5</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="118" case="first-letter">Draft</namespace>
     <namespace key="119" case="first-letter">Draft 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="2300" case="first-letter">Gadget</namespace>
     <namespace key="2301" case="first-letter">Gadget talk</namespace>
     <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
     <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <revision>
     <id>855069164</id>
     <parentid>855063393</parentid>
     <timestamp>2018-08-15T18:33:36Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Undid revision 855063393 by Jdlrobson (talk) rather problematic change mentioned on talk page, reverting until it can be sorted</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="340" xml:space="preserve">Script error: No such module "Infobox".<includeonly>Template:Template other</includeonly><noinclude>

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

     <sha1>f4hgwrnr11ahhwyo266vcd10dpi92pe</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Category link with count</title>
   <ns>10</ns>
   <id>30847816</id>
   <revision>
     <id>1028077630</id>
     <parentid>897610930</parentid>
     <timestamp>2021-06-11T18:13:44Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Support wider range of (valid) input format</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="360" xml:space="preserve">[[:Category:Script error: No such module "string".|<!--

-->Infobox<!-- -->]]&nbsp;(0)<noinclude> Template:Documentation </noinclude></text>

     <sha1>t44qc0k3i1yz2ecwxpiksck04hyz7rx</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clc</title>
   <ns>10</ns>
   <id>52342109</id>
   <redirect title="Template:Category link with count" />
   <revision>
     <id>893875624</id>
     <parentid>827250628</parentid>
     <timestamp>2019-04-24T04:30:59Z</timestamp>
     <contributor>
       <username>JJMC89</username>
       <id>24812038</id>
     </contributor>
     <comment>actual template is in the category</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="47" xml:space="preserve">#REDIRECT Template:Category link with count</text>
     <sha1>092gm3mu5vr84eif0gc6y7q98csnc9h</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>684162145</id>
     <parentid>683948339</parentid>
     <timestamp>2015-10-04T23:53:36Z</timestamp>
     <contributor>
       <username>Nyttend</username>
       <id>1960810</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors; NeilN is okay with this move ([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 bytes="81" xml:space="preserve"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <revision>
     <id>828660796</id>
     <parentid>826539975</parentid>
     <timestamp>2018-03-03T23:40:51Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2018 February 19#Template:Distinguish2 closed as merge (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="290" xml:space="preserve">Script error: No such module "Distinguish".<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>t4az5q8zekjr0kpgvlz6fgo7i77psk8</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col</title>
   <ns>10</ns>
   <id>12679552</id>
   <revision>
     <id>1006814038</id>
     <parentid>1006811674</parentid>
     <timestamp>2021-02-14T23:20:57Z</timestamp>
     <contributor>
       <username>Matt Fitzpatrick</username>
       <id>291848</id>
     </contributor>
     <comment>whitelist parameter class</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="958" xml:space="preserve"><includeonly><templatestyles src="Div col/styles.css"/><!--

--><div class="div-col " <!-- -->><!-- --><!-- Inventory how many pages use small=yes --><!-- --></includeonly>Script error: No such module "Check for unknown parameters".<noinclude> Template:Documentation </noinclude></text>

     <sha1>cwqp9gtrnaa6hga4rh0s9vzcnfwr54n</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col/styles.css</title>
   <ns>10</ns>
   <id>66114304</id>
   <revision>
     <id>998391716</id>
     <parentid>994648498</parentid>
     <timestamp>2021-01-05T04:54:19Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>remove the note as not generally necessary</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="488" xml:space="preserve">/* Template:Pp */

.div-col { margin-top: 0.3em; column-width: 30em; }

.div-col-small { font-size: 90%; }

.div-col-rules { column-rule: 1px solid #aaa; }

/* Reset top margin for lists in div col */ .div-col dl, .div-col ol, .div-col ul { margin-top: 0; }

/* Avoid elements breaking between columns

  See also Template:No col break */

.div-col li, .div-col dd { page-break-inside: avoid; /* Removed from CSS in favor of break-inside c. 2020 */ break-inside: avoid-column; }</text>

     <sha1>n7twp689l8hrwuefq6a9a414zrxegfw</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Div col end</title>
   <ns>10</ns>
   <id>12679680</id>
   <revision>
     <id>683947856</id>
     <parentid>627002509</parentid>
     <timestamp>2015-10-03T15:58:07Z</timestamp>
     <contributor>
       <username>NeilN</username>
       <id>409043</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Div col end: per request at WP:RFPP ([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 bytes="96" xml:space="preserve"><includeonly></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>e0rj08wj8gm7na2mxp8t9b3l4y8kspb</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>948472457</id>
     <parentid>948472454</parentid>
     <timestamp>2020-04-01T06:12:34Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="182" xml:space="preserve">Script error: No such module "documentation".<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>948474229</id>
     <parentid>948472460</parentid>
     <timestamp>2020-04-01T06:32:45Z</timestamp>
     <contributor>
       <username>DannyS712</username>
       <id>34581532</id>
     </contributor>
     <comment>Reverted to revision 617432645 by Sardanaphalus (talk): Restoring (TW)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1667" xml:space="preserve"><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:High-use</title>
   <ns>10</ns>
   <id>17406187</id>
   <revision>
     <id>1016519090</id>
     <parentid>928975377</parentid>
     <timestamp>2021-04-07T16:19:05Z</timestamp>
     <contributor>
       <username>GKFX</username>
       <id>14918984</id>
     </contributor>
     <comment>Allow system= to be passed through</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="297" xml:space="preserve">Script error: No such module "High-use".<noinclude>

Template:Documentation <!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! --> </noinclude></text>

     <sha1>pqp5tan0gkp2stociv4f3zgylzoarl5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>1049450711</id>
     <parentid>1039952971</parentid>
     <timestamp>2021-10-11T22:27:26Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>/* Full blank syntax */ add templatestyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="30769" xml:space="preserve">Template:Distinguish

Template:Documentation subpage <includeonly>Template:High-useTemplate:Lua</includeonly> Template:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Template:Tlf is a meta-template: used to organise an actual <nowiki>Template:Infobox sometopic</nowiki> template (like Template:Tl).

For <code><nowiki>Template:Infobox sometopic</nowiki></code>, template code then looks like this, simplified: <pre> Template loop detected: Template:Infobox </pre>

Optional control parameters

name
If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page. You may use the value <nowiki>Infobox</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change.
child
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
autoheaders
If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "hiding headers when all its data fields are empty" section for more details.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended):

title
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below {{{title}}} and Text in uppermost cell of infobox, but before images.

Examples:

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template loop detected: Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template loop detected: Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template loop detected: Template:Infobox</nowiki></code>.

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

or,

Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template loop detected: Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template loop detected: Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>Script error: No such module "Lua banner".</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>Script error: No such module "Parameter names example".</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">Script error: No such module "Sidebar".<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header"><!--
+header:

-->This is the <!--

 +header,  +link TD; DEFAULT:

-->TemplateData<!--

  e.o. #if:nolink; DEFAULT:

--> for this template used by TemplateWizard, VisualEditor and other tools. Template:Template parameter usage<!--

  e.o. #if:noheader

-->

TemplateData for Infobox </div><includeonly><!--

check parameters

-->Script error: No such module "Check for unknown parameters".<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">Script error: No such module "Template link general".<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>Script error: No such module "Template link general".</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">click here to see a monthly parameter usage report for this template.<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although, per WP:Manual of Style/Infoboxes, all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "40" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the | magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("40") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template loop detected: Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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: -- -- Script error: No such module "Protection banner". -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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: Script error: No such module "String". OR Script error: No such module "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: Script error: No such module "String". OR Script error: No such module "String".

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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: Script error: No such module "String". OR Script error: No such module "String".

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: Script error: No such module "String".

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: Script error: No such module "String". ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki> </pre>Template:Clear

Illustration images

image(n)
images to display at the top of the template. Use full image syntax, for example <nowiki>200px</nowiki>. Image is centered by default. See WP:ALT for more on alt text.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Template:Para will cause the corresponding Template:Para (and Template:Para Template:Para, see below) to be ignored; the absence of a Template:Para will cause the corresponding Template:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

<pre style="overflow:auto">

| header3  = Section 1
|  label5  = Label A
|   data5  = Data A
|  label7  = Label C
|   data7  = Data C
| header10 = Section 2
|  label12 = Label D
|   data12 = Data D

</pre>Template:Clear

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

<pre style="overflow:auto">

|  label5 = Population
|   data5 = 

</pre>Template:Clear

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

<pre style="overflow:auto">

|  label6 = Mass
|   data6 = 

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all its data fields are empty

You can also make headers automatically hide when their section is empty (has no data-row showing).

Consider this situation: Template:Infobox <pre style="overflow:auto"> Template:Infobox </pre>Template:Clear

If you want hide the header when no Template:Para values are present, use Template:Para:

Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template:Infobox </syntaxhighlight>Template:Clear

So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content.

Note: if the data has empty css elements, like Template:Para, this will be treated as non-empty (having data).

If Template:Para but there are items that you do not want to trigger a header, place Template:Para. This will serve as an empty header and separate it from the subsequent items.

Template:Infobox

<syntaxhighlight lang="moin" style="overflow:auto"> Template:Infobox </syntaxhighlight>Template:Clear

Footer

below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the <code>italic title</code> parameter.

  • Turn on italic titles by passing Template:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Template:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

Template:Div col

bodystyle
Applies to the infobox table as a whole
titlestyle
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle
Applies to the text of the image caption.
rowstyle(n)
This parameter is inserted into the <code>style</code> attribute for the specified row.
headerstyle
Applies to all header cells
subheaderstyle
Applies to all subheader cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

Template:Div col end

HTML classes and microformats

Template:Div col

bodyclass
This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
titleclass
This parameter is inserted into the <code>class</code> attribute for the infobox's title caption.

<!-- currently not implemented in Lua module

aboverowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the above cell is on.

-->

aboveclass
This parameter is inserted into the <code>class</code> attribute for the infobox's above cell.
subheaderrowclass(n)
This parameter is inserted into the <code>class</code> attribute for the complete table row the subheader is on.
subheaderclass(n)
This parameter is inserted into the <code>class</code> attribute for the infobox's subheader.
imagerowclass(n)
These parameters are inserted into the <code>class</code> attribute for the complete table row their respective image is on.
imageclass
This parameter is inserted into the <code>class</code> attribute for the image.
rowclass(n)
This parameter is inserted into the <code>class</code> attribute for the specified row including the label and data cells.
class(n)
This parameter is inserted into the <code>class</code> attribute for the data cell of the specified row. If there's no data cell it has no effect.

<!-- currently not implemented in Lua module

belowrowclass
This parameter is inserted into the <code>class</code> attribute for the complete table row the below cell is on.

-->

belowclass
This parameter is inserted into the <code>class</code> attribute for the infobox's below cell.

Template:Div col end

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

<pre style="overflow:auto">

| bodyclass = vcard

</pre>Template:Clear

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

<pre style="overflow:auto">

| class1 = fn
| class2 = org
| class3 = tel

</pre>Template:Clear

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Template:Infobox <syntaxhighlight lang="Sass" style="overflow:auto" highlight="15"> Template:Infobox </syntaxhighlight>Template:Clear

For this example, the Template:Para and Template:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Template:Infobox <syntaxhighlight lang="sass" highlight="3,9" style="overflow: auto"> Template:Infobox </syntaxhighlight>Template:Clear

Embedding

<!--Linked from Template:Subinfobox bodystyle/doc--> One infobox template can be embedded into another using the Template:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>Template:Infobox</nowiki></code>.

Template:Infobox <pre style="overflow:auto"> Template:Infobox </pre>Template:Clear

Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Template:Infobox <pre style="overflow:auto"> Template:Infobox </pre>Template:Clear

or,

Template:Infobox <pre style="overflow:auto"> Template:Infobox </pre>Template:Clear

Note that omitting the Template:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using Template:Para, replacing N with the data/header number.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Template:Infobox <syntaxhighlight lang="sass" style="overflow:auto"> Template:Infobox </syntaxhighlight>Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Template:Sidebar <syntaxhighlight lang="sass" style="overflow:auto"> Template:Sidebar </syntaxhighlight>Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Template:Tlx may be used with Template:Tlx and Template:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Template:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

<pre style="overflow:auto"> Template:Infobox </pre>Template:Clear Help:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

TemplateData

Template:TemplateData header <templatedata> {

   "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.",

"format": "Template:\n\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true } }, "paramOrder": [ "title" ] } </templatedata>

See also

<includeonly>Template:Sandbox other</includeonly>

Tracking categories

     <sha1>c24vkm3v8mmy0zyofplabckvulk09re</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>888711835</id>
     <parentid>886057621</parentid>
     <timestamp>2019-03-20T22:04:45Z</timestamp>
     <contributor>
       <username>RMCD bot</username>
       <id>17216044</id>
     </contributor>
     <comment>Removing notice of move discussion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="196" xml:space="preserve"><includeonly>#invoke:Lua banner</includeonly><noinclude>

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

     <sha1>pnmjp3f3fl321yf2jpg5syebi412n7b</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Main other</title>
   <ns>10</ns>
   <id>17220251</id>
   <revision>
     <id>388689011</id>
     <parentid>334818505</parentid>
     <timestamp>2010-10-04T14:46:48Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="409" xml:space="preserve"><noinclude>

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

     <sha1>ngt28vb1n5t4bh1su57btnqyofkd1d5</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold</title>
   <ns>10</ns>
   <id>10981056</id>
   <revision>
     <id>865390504</id>
     <parentid>865336863</parentid>
     <timestamp>2018-10-23T17:15:13Z</timestamp>
     <contributor>
       <username>Frietjes</username>
       <id>13791031</id>
     </contributor>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="192" xml:space="preserve"><templatestyles src="Nobold/styles.css"/><span class="nobold">{{{1}}}</span><noinclude>

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

     <sha1>iaf63qvx3m2zxytvj4dw3wwalq5wusd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Nobold/styles.css</title>
   <ns>10</ns>
   <id>58856178</id>
   <revision>
     <id>886047488</id>
     <parentid>885218100</parentid>
     <timestamp>2019-03-03T23:43:41Z</timestamp>
     <contributor>
       <username>Pppery</username>
       <id>28032115</id>
     </contributor>
     <comment>Adding protection template</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="89" xml:space="preserve">/* Template:Pp-template */

/* Styling for Template:Nobold */ .nobold { font-weight: normal; }</text>

     <sha1>fenpgkszzubv5v79v09z2871g8mgdmr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>948472476</id>
     <parentid>936054140</parentid>
     <timestamp>2020-04-01T06:12:37Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="584" xml:space="preserve"><code class="nowrap" style="{{SAFESUBST:<noinclude />#if:|border: none; background-color: inherit;}} {{SAFESUBST:<noinclude />#if:|color: {{SAFESUBST:<noinclude />#if:|#006400|{{SAFESUBST:<noinclude />#if:|#8B0000|inherit}}}};}} {{SAFESUBST:<noinclude />#if:|{{{style}}}}}">&#124;{{SAFESUBST:<noinclude />#if:|{{{1}}}&#61;}}</code><noinclude>

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

     <sha1>hmpn0o2dcw0l4w04g6qz1zzyrrqvv3i</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Parameter names example</title>
   <ns>10</ns>
   <id>43305139</id>
   <revision>
     <id>804536750</id>
     <parentid>623570683</parentid>
     <timestamp>2017-10-09T17:20:51Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>Protected "Template:Parameter names example": Highly visible template; 1,000+ transclusions ([Edit=Require autoconfirmed or confirmed access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="256" xml:space="preserve"><includeonly>#invoke:Parameter names example</includeonly><noinclude>

Template:Hatnote<!--(hatnote more noticeable here than within Documentation)--> Template:Documentation </noinclude></text>

     <sha1>cjle1o3weadzp7u1v4l5clox5ri8mpi</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sandbox other</title>
   <ns>10</ns>
   <id>48540583</id>
   <revision>
     <id>948779760</id>
     <parentid>929909975</parentid>
     <timestamp>2020-04-03T00:08:09Z</timestamp>
     <contributor>
       <username>Evad37</username>
       <id>16958448</id>
     </contributor>
     <comment>Also match subpage names beginning with "sandbox", per edit request</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="260" xml:space="preserve"><!--

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

     <sha1>h1idujwaw20aducxsd1gc4ovgnjikqa</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>960641546</id>
     <parentid>959179329</parentid>
     <timestamp>2020-06-04T02:43:13Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>TFD closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="68" xml:space="preserve">#invoke:Sidebar<noinclude>

Template:Documentation</noinclude></text>

     <sha1>jzouzofoaugku1umcgwhk1sk23s7qrm</sha1>
   </revision>
 </page>
 <page>
   <title>Template:TemplateData header</title>
   <ns>10</ns>
   <id>40047498</id>
   <revision>
     <id>1041322034</id>
     <parentid>1039941938</parentid>
     <timestamp>2021-08-29T21:32:29Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added "based" parameter to other transclusion</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1114" xml:space="preserve"><div class="templatedata-header">#if:

TemplateData for BASEPAGENAME </div><includeonly><!--

check parameters

-->#invoke:Check for unknown parameters<!-- -->Template:Template other</includeonly><!--

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

     <sha1>pxhfjcmyklg4yst97in9mz897nxe198</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link</title>
   <ns>10</ns>
   <id>1487430</id>
   <revision>
     <id>1014201710</id>
     <parentid>1012903429</parentid>
     <timestamp>2021-03-25T19:03:22Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>Wikipedia:Templates for discussion/Log/2021 March 18#Template:Tlu closed as keep (XFDcloser)</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="167" xml:space="preserve">&#123;&#123;[[Template:{{{1}}}|{{{1}}}]]&#125;&#125;<noinclude>Template:Documentation

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

     <sha1>rf3qx5cilaxlnjqq9fivevkah92ncil</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link expanded</title>
   <ns>10</ns>
   <id>4497810</id>
   <revision>
     <id>989852943</id>
     <parentid>989783834</parentid>
     <timestamp>2020-11-21T12:04:41Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="190" xml:space="preserve">#Invoke:Template link general<noinclude>

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

     <sha1>coojm3pkl18q6hsxqyw9qpihxc7knpv</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template link with link off</title>
   <ns>10</ns>
   <id>16451586</id>
   <revision>
     <id>989853150</id>
     <parentid>989724556</parentid>
     <timestamp>2020-11-21T12:06:17Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>update</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="231" xml:space="preserve"><includeonly>#Invoke:Template link general</includeonly><noinclude>

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

     <sha1>kmn80yu5079jyyvwn623d36xsqq3dch</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>874062289</id>
     <parentid>774731050</parentid>
     <timestamp>2018-12-16T22:06:25Z</timestamp>
     <contributor>
       <username>Amorymeltzer</username>
       <id>141948</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Template:Template other": Highly visible template: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="435" xml:space="preserve"><!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Template parameter usage</title>
   <ns>10</ns>
   <id>51792646</id>
   <revision>
     <id>1039940506</id>
     <parentid>1039918972</parentid>
     <timestamp>2021-08-21T18:02:56Z</timestamp>
     <contributor>
       <username>SUM1</username>
       <id>12712128</id>
     </contributor>
     <comment>Added missing "lc" parameters; added optional "based" parameter to add text "based on this[/its] TemplateData" at end of template</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1438" xml:space="preserve">#switch:<noinclude>

Template:Documentation </noinclude></text>

     <sha1>lpccs26r3pb49u723au85qnq27a3axj</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>66733012</id>
   <redirect title="Template:Template link" />
   <revision>
     <id>1006436965</id>
     <timestamp>2021-02-12T22:03:00Z</timestamp>
     <contributor>
       <username>Anthony Appleyard</username>
       <id>119438</id>
     </contributor>
     <comment>Anthony Appleyard moved page Template:Tl to Template:Template link: Requested by Buidhe at WP:RM/TR: RM closed as move</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="83" xml:space="preserve">#REDIRECT Template:Template link

Template:Redirect category shell</text>

     <sha1>p1dn3i2ckb7gtckkrbn0xh6ckx8nei1</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlf</title>
   <ns>10</ns>
   <id>63645417</id>
   <redirect title="Template:Template link with link off" />
   <revision>
     <id>950726704</id>
     <timestamp>2020-04-13T14:42:57Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlf to Template:Template link with link off: full name to indicate what it does</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="97" xml:space="preserve">#REDIRECT Template:Template link with link off

Template:Redirect category shell</text>

     <sha1>9mrb4gzoa8i94zzxq5i6opzke6v5ntr</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Tlx</title>
   <ns>10</ns>
   <id>65893234</id>
   <redirect title="Template:Template link expanded" />
   <revision>
     <id>989735456</id>
     <timestamp>2020-11-20T18:53:35Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>Primefac moved page Template:Tlx to Template:Template link expanded over redirect: expand name, make it more obvious</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="92" xml:space="preserve">#REDIRECT Template:Template link expanded

Template:Redirect category shell</text>

     <sha1>3q8x11tutc2rrxvxoewmgkhc3iqdc08</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno</title>
   <ns>10</ns>
   <id>22255088</id>
   <revision>
     <id>975364754</id>
     <parentid>821904792</parentid>
     <timestamp>2020-08-28T03:15:17Z</timestamp>
     <contributor>
       <username>Xaosflux</username>
       <id>502540</id>
     </contributor>
     <comment>add additional paramerters, "t", "f" - requested on talk - worked in sandbox /testcases</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="374" xml:space="preserve">{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: ¬ }}
|no
|n
|f
|false
|off
|0        = <!-- null -->
|         = <!-- null -->
|¬        = 
|yes
|y
|t
|true
|on
|1        = yes
|#default = yes

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

     <sha1>bioaq6x8oitfnx7oqmfhviol4hbp1nd</sha1>
   </revision>
 </page>
 <page>
   <title>Template:Yesno-no</title>
   <ns>10</ns>
   <id>48375573</id>
   <revision>
     <id>825510157</id>
     <parentid>804450734</parentid>
     <timestamp>2018-02-13T20:27:17Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>separate pp-template not needed</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="269" xml:space="preserve">{{safesubst:<noinclude />yesno|{{{1}}}|yes=yes|no=no|blank=no|¬=no|def=no}}<noinclude>

Template:Documentation <!--Categories go in the doc page referenced above; interwikis go in Wikidata.--> </noinclude></text>

     <sha1>34vmtxa9ubuh1vz2ulp78m5ela68riu</sha1>
   </revision>
 </page>
 <page>
   <title>Help:Infobox/user style</title>
   <ns>12</ns>
   <id>49658456</id>
   <revision>
     <id>1049450892</id>
     <parentid>1013355183</parentid>
     <timestamp>2021-10-11T22:29:09Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>adjust in preparation for infoboxes going to TemplateStyles</comment>
     <model>wikitext</model>
     <format>text/x-wiki</format>
     <text bytes="1966" xml:space="preserve">

Infoboxes and user style

Users can have user CSS that hides<!--, moves, or makes collapsible--> any infoboxes in their own browsers.

To hide all infoboxes, add the following to Special:MyPage/common.css (for all skins, or Special:MyPage/skin.css for just the current skin), on a line by itself: <syntaxhighlight lang="css">div.mw-parser-output .infobox { display: none; }</syntaxhighlight>

Alternatively, you can add the following code to your common.js or into a browser user script that is executed by an extension like Greasemonkey:

<syntaxhighlight lang="js">$('.infobox').hide();</syntaxhighlight>

Be aware that although#if: all information in an infobox ideally should also be found in the main body of an article, there isn't perfect compliance with this guideline. For example, the full taxonomic hierarchy in Template:Tlx, and the OMIM and other medical database codes of Template:Tlx are often not found in the main article content. The infobox is also often the location of the most significant, even only, image in an article.<!--

Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

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

     <sha1>ct0bhlc0w6ny9d9yezjyh58103cjn9l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Arguments</title>
   <ns>828</ns>
   <id>41298065</id>
   <revision>
     <id>948472485</id>
     <parentid>948472482</parentid>
     <timestamp>2020-04-01T06:12:40Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10054" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from

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

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

local arguments = {}

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

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

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

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

local function tidyValNoChange(key, val) return val end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return args end

return arguments</text>

     <sha1>5qx9tzlul9ser30uxj9nbasjt92cevn</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Check for unknown parameters</title>
   <ns>828</ns>
   <id>42286729</id>
   <revision>
     <id>1033173056</id>
     <parentid>934641291</parentid>
     <timestamp>2021-07-12T02:18:24Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>use preview warning rather than not-hatnote hatnote</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3123" xml:space="preserve">-- This module may be used to compare the arguments passed to the parent

-- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {}

local function trim(s) return s:match('^%s*(.-)%s*$') end

local function isnotempty(s) return s and s:match('%S') end

local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end

function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end

-- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end

-- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end

-- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, '

if mw.getCurrentFrame():preprocess( "REVISIONID" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == then v = ' ' end

-- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end

return table.concat(res) end

function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end

return p</text>

     <sha1>6e3cz07yurudsa5um7bq4jcfyxhamf4</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Distinguish</title>
   <ns>828</ns>
   <id>50437969</id>
   <revision>
     <id>833561758</id>
     <parentid>833559553</parentid>
     <timestamp>2018-04-01T10:06:10Z</timestamp>
     <contributor>
       <username>Galobtter</username>
       <id>19502780</id>
     </contributor>
     <comment>fixed with text and selfref</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="897" xml:space="preserve">local mHatnote = require('Module:Hatnote')

local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return end local text = string.format( 'Not to be confused with %s.', text or mHatlist.orList(args, true) ) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p</text>

     <sha1>0e9s40s10w9aih1qwh96v3jypzotm48</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation</title>
   <ns>828</ns>
   <id>40256557</id>
   <revision>
     <id>1049491596</id>
     <parentid>1035088965</parentid>
     <timestamp>2021-10-12T04:08:05Z</timestamp>
     <contributor>
       <username>Sdkb</username>
       <id>13006032</id>
     </contributor>
     <comment>Added purge button for uncreated documentation, per discussion here.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="34969" xml:space="preserve">-- This module implements Template:Documentation.

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

-- 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

return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) 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 -- 'documentation-toolbar' return '<span class="' .. message('toolbar-class') .. '">(' .. table.concat(ret, ' &#124; ') .. ')</span>' 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


-- Entry points


function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end

p.main = makeInvokeFunc('_main')

function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', , {src=cfg['templatestyles'] }) .. 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. -- -- 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.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


p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')

function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end

function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '50px' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> 'template sandbox page' -- 'sandbox-notice-pagetype-module' --> 'module sandbox page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to 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 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 compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category'))

-- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) 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 = 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. return require('Module:Protection banner')._main{ message('protection-reason-edit'), 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. return require('Module:Protection banner')._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 or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end

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

local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = 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][purge] 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 local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) 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) 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] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink, purgeLink) end return ret end

function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '50px' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- '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 else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end

-- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') 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 -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :cssText(data.headingStyleText) :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 -- --]=]

-- 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 link box. 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 ) .. '<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" end end

local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done()

return '\n' .. tostring(box) 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' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'} local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end 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) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end 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


-- 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>rdmtq2ivn0nficvoi6qskql445wye3f</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/config</title>
   <ns>828</ns>
   <id>41520829</id>
   <revision>
     <id>1035219602</id>
     <parentid>1033083068</parentid>
     <timestamp>2021-07-24T11:26:43Z</timestamp>
     <contributor>
       <username>Gonnym</username>
       <id>14984434</id>
     </contributor>
     <comment>Removing print config values as the code calling them was removed from the main module User:Trialpears</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="17605" xml:space="preserve">----------------------------------------------------------------------------------------------------

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


local 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'] = '50px'

--[[ -- 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'] = '50px'

-- 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'] | cfg['testcases-run-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'

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


-- Test cases link configuration


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

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

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

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

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

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

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


-- HTML and CSS configuration


-- cfg['templatestyles'] -- The name of the TemplateStyles page where CSS is kept. -- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed. cfg['templatestyles'] = 'Module:Documentation/styles.css'

-- cfg['container'] -- Class which can be used to set flex or grid CSS on the -- two child divs documentation and documentation-metadata cfg['container'] = 'documentation-container'

-- cfg['main-div-classes'] -- Classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'documentation'

-- cfg['main-div-heading-class'] -- Class for the main heading for templates and modules and assoc. talk spaces cfg['main-div-heading-class'] = 'documentation-heading'

-- cfg['start-box-class'] -- Class for the start box cfg['start-box-class'] = 'documentation-startbox'

-- cfg['start-box-link-classes'] -- Classes used for the [view][edit][history] or [create] links in the start box. -- mw-editsection-like is per Wikipedia:Village pump (technical)/Archive 117 cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'

-- cfg['end-box-class'] -- Class for the end box. cfg['end-box-class'] = 'documentation-metadata'

-- cfg['end-box-plainlinks'] -- Plainlinks cfg['end-box-plainlinks'] = 'plainlinks'

-- cfg['toolbar-class'] -- Class added for toolbar links. cfg['toolbar-class'] = 'documentation-toolbar'

-- cfg['clear'] -- Just used to clear things. cfg['clear'] = 'documentation-clear'



-- 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>b4q19xtmong09jk2p12b7u59pglqxkg</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Documentation/styles.css</title>
   <ns>828</ns>
   <id>61440006</id>
   <revision>
     <id>989579069</id>
     <parentid>989578481</parentid>
     <timestamp>2020-11-19T20:21:58Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Changed protection level for "Module:Documentation/styles.css": actually match module ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="716" xml:space="preserve">/* Template:Pp */

.documentation, .documentation-metadata { border: 1px solid #a2a9b1; background-color: #ecfcf4; clear: both; }

.documentation { margin: 1em 0 0 0; padding: 1em; }

.documentation-metadata { margin: 0.2em 0; /* same margin left-right as .documentation */

   font-style: italic;
   padding: 0.4em 1em; /* same padding left-right as .documentation */

}

.documentation-startbox { padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex; }

.documentation-heading { font-weight: bold; font-size: 125%; }

.documentation-clear { /* Don't want things to stick out where they shouldn't. */ clear: both; }

.documentation-toolbar { font-style: normal; font-size: 85%; }</text>

     <sha1>o2ia525en7wbq32mq4fpdevtl5d6pcb</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection expiry</title>
   <ns>828</ns>
   <id>48785459</id>
   <revision>
     <id>948472505</id>
     <parentid>948472504</parentid>
     <timestamp>2020-04-01T06:12:42Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1494" xml:space="preserve">local p = {}

-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known. -- 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 stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title) return stabilitySettings and stabilitySettings.expiry or 'unknown' 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 local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename) if rawExpiry == 'infinity' then return 'infinity' elseif rawExpiry == then return 'unknown' else local year, month, day, hour, minute, second = rawExpiry:match( '^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$' ) if year then return string.format( '%s-%s-%sT%s:%s:%s', year, month, day, hour, minute, second ) else error('internal error in Module:Effective protection expiry; malformed expiry timestamp') end end end

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

return p</text>

     <sha1>i1wms02y1w048cq6uttka18a5pjzp63</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Effective protection level</title>
   <ns>828</ns>
   <id>41617327</id>
   <revision>
     <id>980896975</id>
     <parentid>948472507</parentid>
     <timestamp>2020-09-29T03:38:47Z</timestamp>
     <contributor>
       <username>Jackmcbarn</username>
       <id>19285809</id>
     </contributor>
     <comment>bring in changes from sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3438" xml:space="preserve">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.ext.FlaggedRevs.getStabilitySettings(title) level = level and level.autoreview 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' and action ~= 'undelete' then error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page return 'interfaceadmin' else -- any non-JS/CSS MediaWiki page return 'sysop' end elseif title.namespace == 2 and title.isSubpage then if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page return 'interfaceadmin' elseif title.contentModel == 'json' then -- user JSON page return 'sysop' end end if action == 'undelete' then return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' 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 'templateeditor' elseif title.namespace == 6 then return 'filemover' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then if not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif level == 'extendedconfirmed' then return 'extendedconfirmed' else return 'autoconfirmed' end 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>d3lhy0comfcfe9lnnj8klmrfqm1oxw7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:File link</title>
   <ns>828</ns>
   <id>42903140</id>
   <revision>
     <id>948474149</id>
     <parentid>948472509</parentid>
     <timestamp>2020-04-01T06:31:54Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472508 by [[Special:Contributions/w>IPad365|w>IPad365]] ([[User talk:w>IPad365|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks.

local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType

local p = {}

function p._main(args) checkType('_main', 1, args, 'table')

-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end

local ret = {}

-- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end

-- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end

-- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file

-- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end

-- Border if yesno(args.border) then ret[#ret + 1] = 'border' end

addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption')

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

function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end

-- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like File:Example.png. if v == '_BLANK' then v = end args[k] = v end return p._main(args) end

return p</text>

     <sha1>bzc22v133v9z5yc4aisazripn6l94p8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote</title>
   <ns>828</ns>
   <id>42498502</id>
   <revision>
     <id>1033185030</id>
     <parentid>970298780</parentid>
     <timestamp>2021-07-12T04:21:02Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>we templatestyles now</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="8955" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the Template:Hatnote and Template:Format link meta-templates and includes -- -- helper functions for other Lua hatnote modules. --


local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise Module:Arguments local yesno -- lazily initialise Module:Yesno

local p = {}


-- Helper functions


local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end

local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end

function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end

function p.formatPages(...) -- Formats a list of pages using formatLink and returns it as an array. Nil -- values are not allowed. local pages = {...} local ret = {} for i, page in ipairs(pages) do ret[i] = p._formatLink{link = page} end return ret end

function p.formatPageTables(...) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local pages = {...} local links = {} for i, t in ipairs(pages) do checkType('formatPageTables', i, t, 'table') local link = t[1] local display = t[2] links[i] = p._formatLink{link = link, display = display} end return links end

function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- Module:Yesno, and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' (help)' else helpText = end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = string.format( '%s:%s', mw.site.namespaces[14].name, category ) else category = end return string.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end

function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return string.format('%s (%s)', page, disambiguator) end


-- Format link -- -- Makes a wikilink from the given link and display values. Links are escaped -- with colons if necessary, and links to sections are detected and displayed -- with " § " as a separator rather than the standard MediaWiki "#". Used in -- the Template:Format link template.


function p.formatLink(frame) -- The formatLink export function, for use in templates. yesno = require('Module:Yesno') local args = getArgs(frame) local link = args[1] if not link then return p.makeWikitextError( 'no link specified', 'Template:Format link#Errors', args.category ) end return p._formatLink{ link = link, display = args[2], italicizePage = yesno(args.italicizepage), italicizeSection = yesno(args.italicizesection), } end

local function italicize(s) -- Italicize a string. return '<i>' .. s .. '</i>' end

local function maybeItalicize(s, shouldItalicize) -- italicize s if s is a string and the shouldItalicize parameter is true. if s and shouldItalicize then return italicize(s) else return s end end

local function parseLink(link) -- Parse a link and return a table with the link's components. -- These components are: -- - link: the link, stripped of any initial colon (always present) -- - page: the page name (always present) -- - section: the page name (may be nil) -- - display: the display text, if manually entered after a pipe (may be nil) link = removeInitialColon(link)

-- Find whether a faux display value has been added with the ! magic -- word. local prePipe, display = link:match('^(.-)|(.*)$') link = prePipe or link

-- Find the page, if it exists. -- For links like #Bar, the page will be nil. local preHash, postHash = link:match('^(.-)#(.*)$') local page if not preHash then -- We have a link like Foo. page = link elseif preHash ~= then -- We have a link like Foo#Bar. page = preHash end

-- Find the section, if it exists. local section if postHash and postHash ~= then section = postHash end

return { link = link, page = page, section = section, display = display, } end

function p._formatLink(options) -- The formatLink export function, for use in modules. checkType('_formatLink', 1, options, 'table') checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false) checkTypeForNamedArg( '_formatLink', 'display', options.display, 'string', true ) checkTypeForNamedArg( '_formatLink', 'italicizePage', options.italicizePage, 'boolean', true ) checkTypeForNamedArg( '_formatLink', 'italicizeSection', options.italicizeSection, 'boolean', true )

local parsed = parseLink(options.link) local display = options.display or parsed.display

-- Deal with the case where we don't have to pipe the link if not display and not parsed.section and not options.italicizePage then return string.format('%s', parsed.link) end

-- Find the display text for piped links if not display then local page = maybeItalicize(parsed.page, options.italicizePage) local section = maybeItalicize(parsed.section, options.italicizeSection) if not page then display = string.format('§&nbsp;%s', section) elseif section then display = string.format('%s §&nbsp;%s', page, section) else display = page end end

return string.format('%s', parsed.link, display) end


-- Hatnote -- -- Produces standard hatnote text. Implements the Template:Hatnote template.


function p.hatnote(frame) local args = getArgs(frame) local s = args[1] local options = {} if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end options.extraclasses = args.extraclasses options.selfref = args.selfref return p._hatnote(s, options) end

function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local classes = {'hatnote', 'navigation-not-searchable'} local extraclasses = options.extraclasses local selfref = options.selfref if type(extraclasses) == 'string' then classes[#classes + 1] = extraclasses end if selfref then classes[#classes + 1] = 'selfref' end return string.format( '%s<div role="note" class="%s">%s</div>', mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } }, table.concat(classes, ' '), s ) end

return p</text>

     <sha1>8jl4tbplx9vbofd81vddfc42fqmupj3</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote/styles.css</title>
   <ns>828</ns>
   <id>61325919</id>
   <revision>
     <id>1033289096</id>
     <parentid>1033184688</parentid>
     <timestamp>2021-07-12T19:22:27Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per my talk page</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="415" xml:space="preserve">/* Template:Pp */

.hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes.

* TODO: Remove link if/when WMF resolves T200206 */

.hatnote + link + .hatnote { margin-top: -0.5em; }</text>

     <sha1>7znvdfdw9mn3ta8a2ioyp35gizwnv4c</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Hatnote list</title>
   <ns>828</ns>
   <id>50085079</id>
   <revision>
     <id>962885277</id>
     <parentid>962884504</parentid>
     <timestamp>2020-06-16T15:02:40Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Module:Hatnote instead of Module:Hatnote/sandbox</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="7222" xml:space="preserve">--------------------------------------------------------------------------------

-- Module:Hatnote list -- -- -- -- This module produces and formats lists for use in hatnotes. In particular, -- -- it implements the for-see list, i.e. lists of "For X, see Y" statements, -- -- as used in Template:About, Template:Redirect, and their variants. Also introduced -- -- are andList & orList helpers for formatting lists with those conjunctions. --


local mArguments --initialize lazily local mHatnote = require('Module:Hatnote') local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}


-- List stringification helper functions -- -- These functions are used for stringifying lists, usually page lists inside -- the "Y" portion of "For X, see Y" for-see items.


--default options table used across the list stringification functions local stringifyListDefaultOptions = { conjunction = "and", separator = ",", altSeparator = ";", space = " ", formatted = false }

-- Stringifies a list generically; probably shouldn't be used directly function stringifyList(list, options) -- Type-checks, defaults, and a shortcut checkType("stringifyList", 1, list, "table") if #list == 0 then return nil end checkType("stringifyList", 2, options, "table", true) options = options or {} for k, v in pairs(stringifyListDefaultOptions) do if options[k] == nil then options[k] = v end end local s = options.space -- Format the list if requested if options.formatted then list = mHatnote.formatPages(unpack(list)) end -- Set the separator; if any item contains it, use the alternate separator local separator = options.separator --searches display text only local function searchDisp(t, f) return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) end for k, v in pairs(list) do if searchDisp(v, separator) then separator = options.altSeparator break end end -- Set the conjunction, apply Oxford comma, and force a comma if #1 has "§" local conjunction = s .. options.conjunction .. s if #list == 2 and searchDisp(list[1], "§") or #list > 2 then conjunction = separator .. conjunction end -- Return the formatted string return mw.text.listToText(list, separator .. s, conjunction) end

--DRY function function conjList (conj, list, fmt) return stringifyList(list, {conjunction = conj, formatted = fmt}) end

-- Stringifies lists with "and" or "or" function p.andList (...) return conjList("and", ...) end function p.orList (...) return conjList("or", ...) end


-- For see -- -- Makes a "For X, see Y." list from raw parameters. Intended for the -- Template:About and Template:Redirect templates and their variants.


--default options table used across the forSee family of functions local forSeeDefaultOptions = { andKeyword = 'and', title = mw.title.getCurrentTitle().text, otherText = 'other uses', forSeeForm = 'For %s, see %s.', }

--Collapses duplicate punctuation function punctuationCollapse (text) local replacements = { ["%.%.$"] = ".", ["%?%.$"] = "?", ["%!%.$"] = "!", ["%.%]%]%.$"] = ".]]", ["%?%]%]%.$"] = "?]]", ["%!%]%]%.$"] = "!]]" } for k, v in pairs(replacements) do text = string.gsub(text, k, v) end return text end

-- Structures arguments into a table for stringification, & options function p.forSeeArgsToTable (args, from, options) -- Type-checks and defaults checkType("forSeeArgsToTable", 1, args, 'table') checkType("forSeeArgsToTable", 2, from, 'number', true) from = from or 1 checkType("forSeeArgsToTable", 3, options, 'table', true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- maxArg's gotten manually because getArgs() and table.maxn aren't friends local maxArg = 0 for k, v in pairs(args) do if type(k) == 'number' and k > maxArg then maxArg = k end end -- Structure the data out from the parameter list: -- * forTable is the wrapper table, with forRow rows -- * Rows are tables of a "use" string & a "pages" table of pagename strings -- * Blanks are left empty for defaulting elsewhere, but can terminate list local forTable = {} local i = from local terminated = false -- If there is extra text, and no arguments are given, give nil value -- to not produce default of "For other uses, see foo (disambiguation)" if options.extratext and i > maxArg then return nil end -- Loop to generate rows repeat -- New empty row local forRow = {} -- On blank use, assume list's ended & break at end of this loop forRow.use = args[i] if not args[i] then terminated = true end -- New empty list of pages forRow.pages = {} -- Insert first pages item if present table.insert(forRow.pages, args[i + 1]) -- If the param after next is "and", do inner loop to collect params -- until the "and"'s stop. Blanks are ignored: "1|and||and|3" → {1, 3} while args[i + 2] == options.andKeyword do if args[i + 3] then table.insert(forRow.pages, args[i + 3]) end -- Increment to next "and" i = i + 2 end -- Increment to next use i = i + 2 -- Append the row table.insert(forTable, forRow) until terminated or i > maxArg

return forTable end

-- Stringifies a table as formatted by forSeeArgsToTable function p.forSeeTableToString (forSeeTable, options) -- Type-checks and defaults checkType("forSeeTableToString", 1, forSeeTable, "table", true) checkType("forSeeTableToString", 2, options, "table", true) options = options or {} for k, v in pairs(forSeeDefaultOptions) do if options[k] == nil then options[k] = v end end -- Stringify each for-see item into a list local strList = {} if forSeeTable then for k, v in pairs(forSeeTable) do local useStr = v.use or options.otherText local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) forSeeStr = punctuationCollapse(forSeeStr) table.insert(strList, forSeeStr) end end if options.extratext then table.insert(strList, punctuationCollapse(options.extratext..'.')) end -- Return the concatenated list return table.concat(strList, ' ') end

-- Produces a "For X, see Y" string from arguments. Expects index gaps -- but not blank/whitespace values. Ignores named args and args < "from". function p._forSee (args, from, options) local forSeeTable = p.forSeeArgsToTable(args, from, options) return p.forSeeTableToString(forSeeTable, options) end

-- As _forSee, but uses the frame. function p.forSee (frame, from, options) mArguments = require('Module:Arguments') return p._forSee(mArguments.getArgs(frame), from, options) end

return p</text>

     <sha1>fqf9dfriof1mvsvpj4ulnui0b5k1dz1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:High-use</title>
   <ns>828</ns>
   <id>62062952</id>
   <revision>
     <id>1050945202</id>
     <parentid>1037252135</parentid>
     <timestamp>2021-10-20T19:51:10Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:High-use": High-risk template or module: 3784 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6601" xml:space="preserve">local p = {}

-- _fetch looks at the "demo" argument. local _fetch = require('Module:Transclusion_count').fetch local yesno = require('Module:Yesno')

function p.num(frame, count) if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end

-- Build output string local return_value = "" if count == nil then if frame.args[1] == "risk" then return_value = "a very large number of" else return_value = "many" end else -- Use 2 significant figures for smaller numbers and 3 for larger ones local sigfig = 2 if count >= 100000 then sigfig = 3 end

-- Prepare to round to appropriate number of sigfigs local f = math.floor(math.log10(count)) - sigfig + 1

-- Round and insert "approximately" or "+" when appropriate if (frame.args[2] == "yes") or (mw.ustring.sub(frame.args[1],-1) == "+") then -- Round down return_value = string.format("%s+", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) ) * (10^(f))) ) else -- Round to nearest return_value = string.format("approximately&#x20;%s", mw.getContentLanguage():formatNum(math.floor( (count / 10^(f)) + 0.5) * (10^(f))) ) end

-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes if count and count > 250000 and not yesno (frame:getParent().args['no-percent']) then local percent = math.floor( ( (count/frame:callParserFunction('NUMBEROFPAGES', 'R') ) * 100) + 0.5) if percent >= 1 then return_value = string.format("%s&#x20;pages, or roughly %s%% of all", return_value, percent) end end end

return return_value end -- Actions if there is a large (greater than or equal to 100,000) transclusion count function p.risk(frame) local return_value = "" if frame.args[1] == "risk" then return_value = "risk" else local count = _fetch(frame) if count and count >= 100000 then return_value = "risk" end end return return_value end

function p.text(frame, count) -- Only show the information about how this template gets updated if someone -- is actually editing the page and maybe trying to update the count. local bot_text = (frame:preprocess("REVISIONID") == "") and "\n\n----\nPreview message: Transclusion count updated automatically (see documentation)." or

if count == nil then if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end end local title = mw.title.getCurrentTitle() if title.subpageText == "doc" or title.subpageText == "sandbox" then title = title.basePageTitle end

local systemMessages = frame.args['system'] if frame.args['system'] == then systemMessages = nil end

local templateCount = ('on %s pages'):format( mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count)) local used_on_text = "This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used '; if systemMessages then used_on_text = used_on_text .. systemMessages .. ((count and count > 2000) and (", and " .. templateCount) or ("")) else used_on_text = used_on_text .. templateCount .. "" end


local sandbox_text = ("%s's /sandbox or /testcases subpages, or in your own %s. "):format( (mw.title.getCurrentTitle().namespace == 828 and "module" or "template"), title.fullText, title.fullText, mw.title.getCurrentTitle().namespace == 828 and "Module:Sandbox|module sandbox" or "Wikipedia:User pages#SUB|user subpage" )

local infoArg = frame.args["info"] ~= "" and frame.args["info"] if (systemMessages or frame.args[1] == "risk" or (count and count >= 100000) ) then local info = systemMessages and '.<br/>Changes to it can cause immediate changes to the Wikipedia user interface.' or '.' if infoArg then info = info .. "<br />" .. infoArg end sandbox_text = info .. '<br /> To avoid major disruption' .. (count and count >= 100000 and ' and server load' or ) .. ', any changes should be tested in the ' .. sandbox_text .. 'The tested changes can be added to this page in a single edit. ' else sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') .. 'hanges may be widely noticed. Test changes in the ' .. sandbox_text end


local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes ' if frame.args["2"] and frame.args["2"] ~= "" and frame.args["2"] ~= "yes" then discussion_text = string.format("%sat %s", discussion_text, frame.args["2"]) else discussion_text = string.format("%son the talk page", discussion_text, title.talkPageTitle.fullText ) end

return used_on_text .. sandbox_text .. discussion_text .. " before implementing them." .. bot_text end

function p.main(frame) local count = nil if yesno(frame.args['fetch']) == false then if (frame.args[1] or ) ~= then count = tonumber(frame.args[1]) end else count = _fetch(frame) end local image = "40px" local type_param = "style" local epilogue = if frame.args['system'] and frame.args['system'] ~= then image = "40px" type_param = "content" local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] local categorise = (nocat == or not yesno(nocat)) if categorise then epilogue = frame:preprocess('Template:Sandbox other') end elseif (frame.args[1] == "risk" or (count and count >= 100000)) then image = "40px" type_param = "content" end

if frame.args["form"] == "editnotice" then return frame:expandTemplate{ title = 'editnotice', args = { ["image"] = image, ["text"] = p.text(frame, count), ["expiry"] = (frame.args["expiry"] or "") } } .. epilogue else return require('Module:Message box').main('ombox', { type = type_param, image = image, text = p.text(frame, count), expiry = (frame.args["expiry"] or "") }) .. epilogue end end

return p</text>

     <sha1>b4fb2q3p0dvgvvrje0o9r7tof27sa1z</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>1049450226</id>
     <parentid>1049450087</parentid>
     <timestamp>2021-10-11T22:22:54Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>ocd triggered</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18858" xml:space="preserve">local p = {}

local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end

if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, ) s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end

-- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', ) end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs)

if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( ) end elseif rowArgs.data and rowArgs.data:gsub( category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or ) end end

local function renderTitle() if not args.title then return end

has_rows = true root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow() if not args.above then return end

has_rows = true root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow() if not args.below then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then has_rows = true local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or ) end end

local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ):match('^%S') then

has_rows = true local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or ) end end

local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows()

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end

local function renderNavBar() if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end

local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(mw.getCurrentFrame():expandTemplate({title = 'italic title'})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext() end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do#Infobox and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame()

-- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, -- see function description templatestyles, child_templatestyles, grandchild_templatestyles }) end

-- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle)

renderTitle() renderAboveRow() else root = mw.html.create()

root :wikitext(args.title) end structure_infobox_common()

return loadTemplateStyles() .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old Template:Infobox did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters()

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end

parseDataParameters()

return _infobox() end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end

parseDataParameters()

return _infobox() end return p</text>

     <sha1>mub4z1wjimlb7sij0tmufeqdgcb806l</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Infobox/styles.css</title>
   <ns>828</ns>
   <id>68912159</id>
   <revision>
     <id>1048617464</id>
     <parentid>1048616812</parentid>
     <timestamp>2021-10-07T01:18:14Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>add a stronger note</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="651" xml:space="preserve">/* Template:Pp */

/*

* This TemplateStyles sheet deliberately does NOT include the full set of
* infobox styles. We are still working to migrate all of the manual
* infoboxes. See MediaWiki talk:Common.css/to do#Infobox
* DO NOT ADD THEM HERE
*/

/*

* not strictly certain these styles are necessary since the modules now
* exclusively output infobox-subbox or infobox, not both
* just replicating the module faithfully
*/

.infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; }

.infobox-3cols-child { margin: auto; }</text>

     <sha1>95le3j475dih4ctx6bma6age6cbvibs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:List</title>
   <ns>828</ns>
   <id>41068627</id>
   <revision>
     <id>915206629</id>
     <parentid>914636065</parentid>
     <timestamp>2019-09-11T21:05:14Z</timestamp>
     <contributor>
       <username>Paine Ellsworth</username>
       <id>9092818</id>
     </contributor>
     <comment>xfer from sandbox per edit request on talk page</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5410" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted,

-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported.

local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools')

local p = {}

local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true }

function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {}

-- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist hlist-separated') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class)

-- Main div style data.style = args.style

-- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end

-- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type']

-- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end

-- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end

-- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end

-- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style

-- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end

return data end

function p.renderList(data) -- Renders the list HTML.

-- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return end

-- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end

-- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end

-- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end

return tostring(root) end

function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = if isDeprecated then ret = ret .. end return ret end

function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end

for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame, { valueFunc = function (key, value) if not value or not mw.ustring.find(value, '%S') then return nil end if mw.ustring.find(value, '^%s*[%*#;:]') then return value else return value:match('^%s*(.-)%s*$') end return nil end }) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end

return p</text>

     <sha1>1kfxv6e8upfdko23gc41ky0lax25kzs</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Lua banner</title>
   <ns>828</ns>
   <id>42951651</id>
   <revision>
     <id>1043920761</id>
     <parentid>961849059</parentid>
     <timestamp>2021-09-12T17:48:53Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>bypass redirect on Commons for File:Lua-Logo.svg – requested by User:Christian75 in Special:Diff/1043853071</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3872" xml:space="preserve">-- This module implements the Template:Lua template.

local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box')

local p = {}

function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= then args[k] = v end end return p._main(args) end

function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end

function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = '<strong class="error">Error: no modules specified</strong>' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) local maybeSandbox = mw.title.new(module .. '/sandbox') if maybeSandbox.exists then moduleLinks[i] = moduleLinks[i] .. string.format(' (sandbox)', maybeSandbox.fullText) end end local moduleList = mList.makeList('bulleted', moduleLinks) local title = mw.title.getCurrentTitle() if title.subpageText == "doc" then title = title.basePageTitle end if title.contentModel == "Scribunto" then boxArgs.text = 'This module depends on the following other modules:' .. moduleList else boxArgs.text = 'This template uses Lua:\n' .. moduleList end end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image = '30px' return mMessageBox.main('mbox', boxArgs) end

function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return end

local cats = {}

-- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end

-- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle() local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if not subpageBlacklist[titleObj.subpageText] then local protCatName if titleObj.namespace == 10 then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category protCatName = "Templates using under-protected Lua modules" elseif titleObj.namespace == 828 then protCatName = "Modules depending on under-protected modules" end if not args.noprotcat and protCatName then local protLevels = { autoconfirmed = 1, extendedconfirmed = 2, templateeditor = 3, sysop = 4 } local currentProt if titleObj.id ~= 0 then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt = titleObj.protectionLevels["edit"][1] end if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end for i, module in ipairs(modules) do if module ~= "WP:libraryUtil" then local moduleProt = mw.title.new(module).protectionLevels["edit"][1] if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end if moduleProt < currentProt then cats[#cats + 1] = protCatName break end end end end end for i, cat in ipairs(cats) do cats[i] = string.format(, cat) end return table.concat(cats) end

return p</text>

     <sha1>mqu3ftyf5isdyw3m4lirlz2ea153v2k</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>1027212344</id>
     <parentid>970994177</parentid>
     <timestamp>2021-06-06T18:51:34Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>per tper</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18348" xml:space="preserve">-- 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 yesno = require('Module:Yesno')

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

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


-- Helper functions


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

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

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


-- Box class definition


local MessageBox = {} MessageBox.__index = MessageBox

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

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

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

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

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

return setmetatable(obj, MessageBox) end

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

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

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

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

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

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

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

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

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

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

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

               local talkText
               if self.isSmall then
                   local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
                   talkText = string.format('(talk)', talkLink)
               else
                   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
               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(" <span class='date-container'>(<span class='date'>%s</span>)</span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end

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

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

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

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

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

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

if not cfg.allowMainspaceCategories then return nil end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return tostring(root) end


-- Exports


local p, mt = {}, {}

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

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

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

return setmetatable(p, mt)</text>

     <sha1>kshc0gmfnt1xkzycgdb25urt4m770p1</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>948472514</id>
     <parentid>948472513</parentid>
     <timestamp>2020-04-01T06:12:44Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <minor/>
     <comment>1 revision imported</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="6141" xml:space="preserve">--------------------------------------------------------------------------------

-- 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 = 'Semi-protection-shackle-keyhole.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', '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'}, removalNotice = 'Learn how and when to remove this template message' },

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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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, classes = {'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 = 'Semi-protection-shackle-keyhole.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'}, 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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'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 = 'Semi-protection-shackle-keyhole.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }</text>

     <sha1>rz63o9789otb966y0k5pcntqf0bl6te</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar</title>
   <ns>828</ns>
   <id>38827227</id>
   <revision>
     <id>1040458691</id>
     <parentid>992953067</parentid>
     <timestamp>2021-08-24T17:32:47Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>add text-decoration:inherit; so that underlined hover is in same color at text</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="5152" xml:space="preserve">local p = {}

local cfg = mw.loadData('Module:Navbar/configuration')

local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end

local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end

local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end

return show

end

local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', , ']'} else l = {'', ''} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)

local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or

-- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } }

local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end

for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done()

end

function p._navbar(args)

-- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain

local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or ) .. '; color: ' .. font_color .. ';' end end font_style = (font_style or ) .. ';text-decoration:inherit;'

local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style)

if is_mini then div:addClass(cfg.classes.mini) end

local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end

local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list)

if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end

return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end

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

return p</text>

     <sha1>pktzhjadawuzj4l3ly2m0dn971ajo3o</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/configuration</title>
   <ns>828</ns>
   <id>66010105</id>
   <revision>
     <id>992950717</id>
     <parentid>992950579</parentid>
     <timestamp>2020-12-08T00:17:17Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <minor/>
     <comment>Protected "Module:Navbar/configuration": match parent template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="904" xml:space="preserve">local configuration = {

['templatestyles'] = 'Module:Navbar/styles.css', ['box_text'] = 'This box: ', -- default text box when not plain or mini ['title_namespace'] = 'Template', -- namespace to default to for title ['invalid_title'] = 'Invalid title ', ['classes'] = { -- set a line to nil if you don't want it ['navbar'] = 'navbar', ['plainlinks'] = 'plainlinks', -- plainlinks ['horizontal_list'] = 'hlist', -- horizontal list class ['mini'] = 'navbar-mini', -- class indicating small links in the navbar ['this_box'] = 'navbar-boxtext', ['brackets'] = 'navbar-brackets', -- 'collapsible' is the key for a class to indicate the navbar is -- setting up the collapsible element in addition to the normal -- navbar. ['collapsible'] = 'navbar-collapse', ['collapsible_title_mini'] = 'navbar-ct-mini', ['collapsible_title_full'] = 'navbar-ct-full' } }

return configuration</text>

     <sha1>euidki6p5y779y3t22gmvkjf2jgpam7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Navbar/styles.css</title>
   <ns>828</ns>
   <id>58923020</id>
   <revision>
     <id>992953826</id>
     <parentid>992950418</parentid>
     <timestamp>2020-12-08T00:40:59Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>navbar-mini is never a span, and span doesn't have all the stuff that needs resetting</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="1107" xml:space="preserve">/* Template:Pp */

.navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

/* Navbar styling when nested in infobox and navbox Should consider having a separate TemplateStyles for those specific places using an infobox/navbox and a navbar, or possibly override from using template */ .infobox .navbar { font-size: 100%; }

.navbox .navbar { display: block; font-size: 100%; }

.navbox-title .navbar { /* @noflip */ float: left; /* @noflip */ text-align: left; /* @noflip */ margin-right: 0.5em; }</text>

     <sha1>slh5ct0wdlbpnikxf7x7x9dfeswx1km</sha1>
   </revision>
 </page>
 <page>
   <title>Module:No globals</title>
   <ns>828</ns>
   <id>42567026</id>
   <revision>
     <id>948473889</id>
     <parentid>948472526</parentid>
     <timestamp>2020-04-01T06:28:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472525 by [[Special:Contributions/w>DiBabelYurikBot|w>DiBabelYurikBot]] ([[User talk:w>DiBabelYurikBot|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="307" xml:space="preserve">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:Parameter names example</title>
   <ns>828</ns>
   <id>43325707</id>
   <revision>
     <id>947413724</id>
     <parentid>804712407</parentid>
     <timestamp>2020-03-26T04:07:47Z</timestamp>
     <contributor>
       <username>Andrybak</username>
       <id>23735172</id>
     </contributor>
     <comment>add popular variants of demonstration purposes parameters: nocat=yes, categories=no, and demo=yes</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1599" xml:space="preserve">-- This module implements Template:Parameter names example.

local p = {}

local function makeParam(s) local lb = '&#123;' local rb = '&#125;' return lb:rep(3) .. s .. rb:rep(3) end

local function italicize(s) return "" .. s .. "" end

local function plain(s) return s end

function p._main(args, frame) -- Find how we want to format the arguments to the template. local formatFunc if args._display == 'italics' or args._display == 'italic' then formatFunc = italicize elseif args._display == 'plain' then formatFunc = plain else formatFunc = makeParam end

-- Build the table of template arguments. local targs = {} for k, v in pairs(args) do if type(k) == 'number' then targs[v] = formatFunc(v) elseif not k:find('^_') then targs[k] = v end end targs['nocat'] = 'yes'; targs['categories'] = 'no'; targs['demo'] = 'yes';

-- Find the template name. local template if args._template then template = args._template else local currentTitle = mw.title.getCurrentTitle() if currentTitle.prefixedText:find('/sandbox$') then template = currentTitle.prefixedText else template = currentTitle.basePageTitle.prefixedText end end

-- Call the template with the arguments. frame = frame or mw.getCurrentFrame() local success, result = pcall( frame.expandTemplate, frame, {title = template, args = targs} ) if success then return result else return end end

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:Parameter names example' }) return p._main(args, frame) end

return p</text>

     <sha1>a7o5z39ztbr5ehhznd1pi588b5yaqou</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner</title>
   <ns>828</ns>
   <id>42040984</id>
   <revision>
     <id>1033879006</id>
     <parentid>1013845490</parentid>
     <timestamp>2021-07-16T11:59:29Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>add catonly param which hides both the banner and padlock if set to yes. all testcases pass. tested in sandbox.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="26029" xml:space="preserve">-- 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 makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local effectiveProtectionExpiry = require('Module:Effective protection expiry')._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) if cat then return string.format( '%s', mw.site.namespaces[14].name, cat, sort ) end end

-- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) if not lang then lang = mw.language.getContentLanguage() end 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

-- Given a directed graph formatted as node -> table of direct successors, -- get a table of all nodes reachable from a given node (though always -- including the given node). local function getReachableNodes(graph, 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) -- This always gets the "first" key if k == nil then return retval end toWalk[k] = nil retval[k] = true for _,v in ipairs(graph[k]) do if not retval[v] then toWalk[v] = true end end end end


-- Protection class


local Protection = {} Protection.__index = Protection

Protection.supportedActions = { edit = true, move = true, autoreview = true, upload = 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 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 local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title) if effectiveExpiry == 'infinity' then obj.expiry = 'indef' elseif effectiveExpiry ~= 'unknown' then obj.expiry = validateDate(effectiveExpiry, 'expiry date') 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:isUserScript() -- Whether the page is a user JavaScript or CSS page. local title = self.title return title.namespace == 2 and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) end

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

function Protection:shouldShowLock() -- Whether we should output a banner/padlock return self:isProtected() and not self:isUserScript() end

-- Whether this page needs a protection category. Protection.shouldHaveProtectionCategory = Protection.shouldShowLock

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

function Protection:makeProtectionCategory() if not self:shouldHaveProtectionCategory() then return end

local cfg = self._cfg local title = self.title

-- 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 = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' 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. --]] table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))

--[[ -- 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:isIncorrect() local expiry = self.expiry return not self:shouldHaveProtectionCategory() 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: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 == 'extendedconfirmed' then requestType = 'extended' 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 mw.getCurrentFrame():expandTemplate{ title="vandal-m", args={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:renderImage() local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self.imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self.imageCaption } 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.imageWidth = 40 obj.imageCaption = 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.imageWidth = 20 obj.imageCaption = blurbObj:makeBannerText('tooltip') obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action] or cfg.padlockIndicatorNames.default or 'pp-default' return setmetatable(obj, Padlock) end

function Padlock:__tostring() local frame = mw.getCurrentFrame() -- The nowiki tag helps prevent whitespace at the top of articles. return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{ name = 'indicator', args = {name = self._indicatorName}, content = self:renderImage() } 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 not yesno(args.catonly) and (protectionObj.action == 'edit' or args.demolevel or not getReachableNodes( 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:shouldShowLock() 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>ktral6mmlw9hhlxwgaq85237qklrdx8</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Protection banner/config</title>
   <ns>828</ns>
   <id>42982788</id>
   <revision>
     <id>1035904400</id>
     <parentid>1033879097</parentid>
     <timestamp>2021-07-28T10:04:57Z</timestamp>
     <contributor>
       <username>ProcrastinatingReader</username>
       <id>32939139</id>
     </contributor>
     <comment>remove dupe</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="46013" xml:space="preserve">-- 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. -- -- ${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, autoreview and upload subtables. defaultBanners = { edit = {}, move = {}, autoreview = { default = { alt = 'Page protected with pending changes', tooltip = 'All edits by unregistered and new users are subject to review prior to becoming visible to unregistered users', image = 'Pending-protection-shackle.svg' } }, upload = {} },

-- 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, autoreview and upload 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 persons', }, 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 = 'Office-protection-shackle.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', }, ecp = { description = 'For articles in topic areas authorized by' .. ' ArbCom or' .. ' meets the criteria for community use', tooltip = 'This ${PAGETYPE} is extended-confirmed protected', alt = 'Extended-protected ${PAGETYPE}', }, 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 = 'Office-protection-shackle.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 = 'Office-protection-shackle.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 = 'Move-protection-shackle.svg' }, vandalism = { description = 'For pages protected against' .. ' [[Wikipedia:Vandalism#Page-move vandalism' .. ' |page-move vandalism]]' } }, autoreview = {}, upload = {} },


-- -- 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, autoreview and upload 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', extendedconfirmed = 'This ${PAGETYPE} is currently under extended confirmed protection', }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { default = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review' }, upload = { default = 'Uploading new versions of this ${PAGETYPE} is currently disabled' } },



-- 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, autoreview and upload 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.', }, extendedconfirmed = { default = 'Extended confirmed protection prevents edits from all unregistered editors' .. ' and registered users with fewer than 30 days tenure and 500 edits.' .. ' The policy on community use' .. ' specifies that extended confirmed protection can be applied to combat' .. ' disruption, if semi-protection has proven to be ineffective.' .. ' Extended confirmed protection may also be applied to enforce' .. ' arbitration sanctions.' .. ' Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask for uncontroversial changes supported by' .. ' consensus.' }, 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 = { 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.' }, }, upload = { default = { default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but new versions of the file' .. ' cannot be uploaded until it is unprotected. You can' .. ' request that a new version be uploaded by using a' .. ' protected edit request, or you' .. ' can request' .. ' that the file be unprotected.' } } },


-- 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 protection 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, autoreview and upload subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', extendedconfirmed = 'extended-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { }, upload = { default = 'upload-protected' } },


-- 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 = 'Full-protection-shackle.svg', templateeditor = 'Template-protection-shackle.svg', extendedconfirmed = 'Extended-protection-shackle.svg', autoconfirmed = 'Semi-protection-shackle.svg' }, move = { default = 'Move-protection-shackle.svg', }, autoreview = { default = 'Pending-protection-shackle.svg' }, upload = { default = 'Upload-protection-shackle.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, autoreview and upload subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', extendedconfirmed = 'Wikipedia:Protection policy#extended', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { default = 'Wikipedia:Protection policy#pending' }, upload = { default = 'Wikipedia:Protection policy#upload' } },


-- Padlock indicator names


-- This table provides the "name" attribute for the <indicator> extension tag -- with which small padlock icons are generated. All indicator tags on a page -- are displayed in alphabetical order based on this attribute, and with -- indicator tags with duplicate names, the last tag on the page wins. -- The attribute is chosen based on the protection action; table keys must be a -- protection action name or the string "default". padlockIndicatorNames = { autoreview = 'pp-autoreview', default = 'pp-default' },


-- 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 fully 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'] = 'Wikipedia fully-protected main page files', ['all|all|all|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|all|ecp|extendedconfirmed|all'] = 'Wikipedia extended-confirmed-protected pages', ['all|template|all|all|edit'] = 'Wikipedia fully 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'] = 'Wikipedia semi-protected files', ['all|portal|all|autoconfirmed|edit'] = 'Wikipedia semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Wikipedia semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Wikipedia 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|template|all|templateeditor|edit'] = 'Wikipedia template-protected templates', ['all|template|all|templateeditor|move'] = 'Wikipedia template-protected templates', -- move-protected templates ['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 fully protected categories', ['all|file|all|sysop|edit'] = 'Wikipedia fully-protected files', ['all|project|all|sysop|edit'] = 'Wikipedia fully-protected project pages', ['all|talk|all|sysop|edit'] = 'Wikipedia fully-protected talk pages', ['all|template|all|extendedconfirmed|edit'] = 'Wikipedia extended-confirmed-protected templates', ['all|template|all|sysop|edit'] = 'Wikipedia fully protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia fully protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia fully-protected modules', ['all|module|all|templateeditor|edit'] = 'Wikipedia template-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|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', ['all|file|all|all|upload'] = 'Wikipedia upload-protected files', },


-- 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, upload = false },

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'}, extendedconfirmed = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor', 'extendedconfirmed'}, 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 -- -- 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. However, users can override any of the -- arguments. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-extended'] = {'ecp'}, ['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', catonly = 'yes'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move', catonly = 'yes'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move', catonly = 'yes'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc'] = {action = 'autoreview', small = true}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-upload'] = {action = 'upload'}, ['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 "at" H:i e',


-- Tracking categories


-- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['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'] = 'Full-protection-shackle.svg', ['image-filename-default'] = 'Transparent.gif',


-- End messages


}


-- End configuration


}</text>

     <sha1>504rdzt1403pfg5dzgyxgdybcqace4a</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar</title>
   <ns>828</ns>
   <id>38866323</id>
   <revision>
     <id>1036808367</id>
     <parentid>1013637399</parentid>
     <timestamp>2021-08-02T20:35:56Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>make wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="10521" xml:space="preserve">--

-- This module implements Template:Sidebar -- require('Module:No globals') local cfg = mw.loadData('Module:Sidebar/configuration')

local p = {}

local getArgs = require('Module:Arguments').getArgs

--[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles.

TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return end end

for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end

--[[ For compatibility with the original Template:Sidebar with collapsible lists implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See (meta:Help:Newlines and spaces#Automatic newline) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end

--[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end

--[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes

root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style)

if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end

if args.topimage then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage)

if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end

if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end

if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end

if args.image then local imageCell = root:tag('tr'):tag('td')

imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image)

if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end

if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end

local rowNums = {} for k, v in pairs(args) do k = .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end

for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end

local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* Template:Hlist" doesn't parse correctly. :newline() end end

if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end

if not child then if args.navbar ~= cfg.i18n.navbar_none and args.navbar ~= cfg.i18n.navbar_off and (args.name or frame:getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, ) ~= cfg.i18n.title_not_to_add_navbar) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end end

local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } }

local templatestyles = if args['templatestyles'] and args['templatestyles'] ~= then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end

local child_templatestyles = if args['child templatestyles'] and args['child templatestyles'] ~= then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end

local grandchild_templatestyles = if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end

return table.concat({ base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, tostring(root), (child and cfg.i18n.category.child or ), categorizeTemplatesWithInlineStyles(args) }) end

local function list_title(args, is_centered_list_titles, num)

local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title)

local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end

local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done()

return title_container end

--[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, ) == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end

local contentArgs = {}

local is_centered_list_titles if args['centered list titles'] and args['centered list titles'] ~= then is_centered_list_titles = true else is_centered_list_titles = false end

for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num]))

contentArgs['content' .. num] = tostring(row) end end

for k, v in pairs(contentArgs) do args[k] = v end

return p.sidebar(frame, args, cfg.i18n.class.collapse) end

return p</text>

     <sha1>dqe3p6l293j6ldrj3b5n5gg76puqau7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/configuration</title>
   <ns>828</ns>
   <id>66261134</id>
   <revision>
     <id>1036808391</id>
     <parentid>1013635331</parentid>
     <timestamp>2021-08-02T20:36:03Z</timestamp>
     <contributor>
       <username>Izno</username>
       <id>2927383</id>
     </contributor>
     <comment>wraplinks work like it used to</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1698" xml:space="preserve">return {

i18n = { child_yes = 'yes', float_none = 'none', float_left = 'left', wrap_true = 'true', navbar_none = 'none', navbar_off = 'off', default_list_title = 'List', title_not_to_add_navbar = 'Template:Sidebar', collapse_title_not_to_add_navbar = 'Template:Sidebar with collapsible lists', templatestyles = 'Module:Sidebar/styles.css', category = { child = , conversion = }, pattern = { collapse_sandbox = '/sandbox$', sandbox = '/sandbox$', subgroup = 'sidebar%-subgroup', style_conversion = 'style$', uncategorized_conversion_titles = { '/[Ss]andbox', '/[Tt]estcases', '/[Dd]oc$' } }, class = { sidebar = 'sidebar', subgroup = 'sidebar-subgroup', collapse = 'sidebar-collapse', float_none = 'sidebar-none', float_left = 'sidebar-left', wraplinks = 'nowraplinks', outer_title = 'sidebar-outer-title', top_image = 'sidebar-top-image', top_caption = 'sidebar-top-caption', pretitle = 'sidebar-pretitle', pretitle_with_top_image = 'sidebar-pretitle-with-top-image', title = 'sidebar-title', title_with_pretitle = 'sidebar-title-with-pretitle', image = 'sidebar-image', caption = 'sidebar-caption', above = 'sidebar-above', heading = 'sidebar-heading', content = 'sidebar-content', content_with_subgroup = 'sidebar-content-with-subgroup', below = 'sidebar-below', navbar = 'sidebar-navbar', list = 'sidebar-list', list_title = 'sidebar-list-title', list_title_centered = 'sidebar-list-title-c', list_content = 'sidebar-list-content' } } }</text>

     <sha1>0rujaua8lftdvsbwq4988fo6iw6xlak</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Sidebar/styles.css</title>
   <ns>828</ns>
   <id>66235483</id>
   <revision>
     <id>1045330069</id>
     <parentid>1045150921</parentid>
     <timestamp>2021-09-20T01:15:45Z</timestamp>
     <contributor>
       <username>Goszei</username>
       <id>36510957</id>
     </contributor>
     <comment>self-rv, it's a little tight</comment>
     <model>sanitized-css</model>
     <format>text/css</format>
     <text bytes="3703" xml:space="preserve">/* Template:Pp-template */

/* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */ display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an

* !important on the declaration. So we have to be mean for Minerva users.
* Mobile removes the element entirely with `wgMFRemovableClasses` in 
* https://github.com/wikimedia/operations-mediawiki-config/blob/master/
wmf-config/InitialiseSettings.php#L16992
* which is why displaying it categorically with display: table works.
* We don't really want to expose the generic user in the wild on mobile to have
* to deal with sidebars. (Maybe the ones with collapsible lists, so that
* might be an improvement. That is blocked on phab:T111565.)
*/

body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */

   float: right !important;
   margin: 0.5em 0 1em 1em !important;

}

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :( "Super-specific" selector to prevent overriding this appearance by lower level sidebars too */ body.mediawiki .sidebar { width: 100% !important; clear: both; float: none !important; /* Remove when we div based; Minerva is dumb */ margin-left: 0 !important; margin-right: 0 !important; } /* TODO: We might consider making all links wrap at small resolutions and then * only introduce nowrap at higher resolutions. Do when we invert the media * query. */ }</text>

     <sha1>en9f828813j59rhubpbkm63sj6kasx7</sha1>
   </revision>
 </page>
 <page>
   <title>Module:String</title>
   <ns>828</ns>
   <id>38569505</id>
   <revision>
     <id>970815276</id>
     <parentid>924313232</parentid>
     <timestamp>2020-08-02T15:49:42Z</timestamp>
     <contributor>
       <username>RexxS</username>
       <id>6112901</id>
     </contributor>
     <comment>separate annotations for str.match from those for str._match</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="18033" xml:space="preserve">--[[

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 OR #invoke: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 OR #invoke:String

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. It is exported for use in other modules

Usage: strmatch = require("Module:String")._match sresult = strmatch( s, pattern, start, match, plain, nomatch )

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.

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

]] -- This sub-routine is exported for use in other modules function str._match( s, pattern, start, match_index, plain_flag, nomatch ) if s == then return str._error( 'Target string is empty' ) end if pattern == then return str._error( 'Pattern string is empty' ) end start = tonumber(start) or 1 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

--[[ match

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

Usage: #invoke:String OR #invoke:String

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:

]] -- This is the entry point for #invoke:String|match 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']

return str._match( s, pattern, start, match_index, plain_flag, nomatch ) end

--[[ pos

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

Usage: #invoke:String OR #invoke:String

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 OR #invoke:String

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 OR #invoke:String

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

--[[ escapePattern

This function escapes special characters from a Lua string pattern. See [1] for details on how patterns work.

[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns

Usage: #invoke:String

Parameters

   pattern_string: The pattern string to escape.

]] function str.escapePattern( frame ) local pattern_str = frame.args[1] if not pattern_str then return str._error( 'No pattern string specified' ) end local result = str._escapePattern( pattern_str ) return result end

--[[ count This function counts the number of occurrences of one string in another. ]] function str.count(frame) local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'}) local source = args.source or local pattern = args.pattern or local plain = str._getBoolean(args.plain or true) if plain then pattern = str._escapePattern(pattern) end local _, count = mw.ustring.gsub(source, pattern, ) return count end

--[[ endswith This function determines whether a string ends with another string. ]] function str.endswith(frame) local args = str._getParameters(frame.args, {'source', 'pattern'}) local source = args.source or local pattern = args.pattern or if pattern == then -- All strings end with the empty string. return "yes" end if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then return "yes" else return "" end end

--[[ join

Join all non empty arguments together; the first argument is the separator. Usage: #invoke:String ]] function str.join(frame) local args = {} local sep for _, v in ipairs( frame.args ) do if sep then if v ~= then table.insert(args, v) end else sep = v end end return table.concat( args, sep or ) 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 _, 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>cufmbepw7ml3gut4lchtqrhtj5r63cp</sha1>
   </revision>
 </page>
 <page>
   <title>Module:TableTools</title>
   <ns>828</ns>
   <id>41371028</id>
   <revision>
     <id>1048120640</id>
     <parentid>983044092</parentid>
     <timestamp>2021-10-04T10:40:18Z</timestamp>
     <contributor>
       <username>MSGJ</username>
       <id>42630</id>
     </contributor>
     <comment>improved module formatting; improved isArray; added isArrayLike; fixed _deepCopy; and improved defaultKeySort, code by User:Alexiscoutinho</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="14953" xml:space="preserve">------------------------------------------------------------------------------------

-- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. --


local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti


-- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.


function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end


-- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key.


function p.isNan(v) return type(v) == 'number' and tostring(v) == '-nan' end


-- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.


function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end


-- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.


function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end


-- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.


function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end


-- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}.


function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true)

local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end

prefix = prefix or suffix = suffix or prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end


-- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs.


function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end


-- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.


function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end


-- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.


function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end


-- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator.


function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end

local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end


-- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function.


function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end

local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end

if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end

return arr end


-- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient.


function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true)

local arr = p.keysToList(t, keySort, true)

local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end


-- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1.


function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1.


function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end


-- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}.


function p.invert(arr) checkType("invert", 1, arr, "table")

local map = {} for i, v in ipairs(arr) do map[v] = i end

return map end


-- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}.


function p.listToSet(t) checkType("listToSet", 1, t, "table")

local set = {} for _, item in ipairs(t) do set[item] = true end

return set end


-- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables.


local function _deepCopy(orig, includeMetatable, already_seen) -- Stores copies of tables indexed by the original table. already_seen = already_seen or {}

local copy = already_seen[orig] if copy ~= nil then return copy end

if type(orig) == 'table' then copy = {} for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end already_seen[orig] = copy

if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then local mt_copy = _deepCopy(mt, includeMetatable, already_seen) setmetatable(copy, mt_copy) already_seen[mt] = mt_copy end end else -- number, string, boolean, etc copy = orig end return copy end

function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen) end


-- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd"


function p.sparseConcat(t, sep, i, j) local arr = {}

local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end

return table.concat(arr, sep, i, j) end


-- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args.


function p.length(t, prefix) -- requiring module inline so that Module:Exponential search which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end


-- inArray -- -- Returns true if valueToFind is a member of the array, and false otherwise.


function p.inArray(arr, valueToFind) checkType("inArray", 1, arr, "table") -- if valueToFind is nil, error?

for _, v in ipairs(arr) do if v == valueToFind then return true end end return false end

return p</text>

     <sha1>8dd39dcwkl7evysxliuilyra1x3nban</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Template link general</title>
   <ns>828</ns>
   <id>63673341</id>
   <revision>
     <id>1019778167</id>
     <parentid>1007971488</parentid>
     <timestamp>2021-04-25T10:37:43Z</timestamp>
     <contributor>
       <username>Primefac</username>
       <id>11508456</id>
     </contributor>
     <comment>implement sandbox fix for nowiki issues (TPER)</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="3567" xml:space="preserve">-- This implements Template:Tlg

local getArgs = require('Module:Arguments').getArgs local p = {}

-- Is a string non-empty? local function _ne(s) return s ~= nil and s ~= "" end

local nw = mw.text.nowiki

local function addTemplate(s) local i, _ = s:find(':', 1, true) if i == nil then return 'Template:' .. s end local ns = s:sub(1, i - 1) if ns == or mw.site.namespaces[ns] then return s else return 'Template:' .. s end end

local function trimTemplate(s) local needle = 'template:' if s:sub(1, needle:len()):lower() == needle then return s:sub(needle:len() + 1) else return s end end

local function linkTitle(args) if _ne(args.nolink) then return args['1'] end

local titleObj local titlePart = '[[' if args['1'] then -- This handles :Page and other NS titleObj = mw.title.new(args['1'], 'Template') else titleObj = mw.title.getCurrentTitle() end

titlePart = titlePart .. (titleObj ~= nil and titleObj.fullText or addTemplate(args['1']))

local textPart = args.alttext if not _ne(textPart) then if titleObj ~= nil then textPart = titleObj:inNamespace("Template") and args['1'] or titleObj.fullText else -- redlink textPart = args['1'] end end

if _ne(args.subst) then -- HACK: the ns thing above is probably broken textPart = 'subst:' .. textPart end

if _ne(args.brace) then textPart = nw('Template:') .. textPart .. nw('') elseif _ne(args.braceinside) then textPart = nw('{') .. textPart .. nw('}') end

titlePart = titlePart .. '|' .. textPart .. ']]' if _ne(args.braceinside) then titlePart = nw('{') .. titlePart .. nw('}') end return titlePart end

function p.main(frame) local args = getArgs(frame, { trim = true, removeBlanks = false }) return p._main(args) end

function p._main(args) local bold = _ne(args.bold) or _ne(args.boldlink) or _ne(args.boldname) local italic = _ne(args.italic) or _ne(args.italics) local dontBrace = _ne(args.brace) or _ne(args.braceinside) local code = _ne(args.code) or _ne(args.tt)

-- Build the link part local titlePart = linkTitle(args) if bold then titlePart = "" .. titlePart .. "" end if _ne(args.nowrapname) then titlePart = '<span class="nowrap">' .. titlePart .. '</span>' end

-- Build the arguments local textPart = "" local textPartBuffer = "" local i = 2 while args[i] do local val = args[i] textPartBuffer = textPartBuffer .. '&#124;' if val ~= "" then if _ne(args.nowiki) then -- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will -- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up val = nw(mw.text.unstripNoWiki(val)) end if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end textPart = textPart .. textPartBuffer .. val textPartBuffer = "" end i = i+1 end

-- final wrap local ret = titlePart .. textPart if not dontBrace then ret = nw('Template:') .. ret .. nw('') end if _ne(args.a) then ret = nw('*') .. '&nbsp;' .. ret end if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end if code then ret = '<code>' .. ret .. '</code>' elseif _ne(args.plaincode) then ret = '<code style="border:none;background:transparent;">' .. ret .. '</code>' end if _ne(args.nowrap) then ret = '<span class="nowrap">' .. ret .. '</span>' end

--[[ Wrap as html?? local span = mw.html.create('span') span:wikitext(ret) --]] if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end return ret end

return p</text>

     <sha1>dhji3evsdfs24p2fyzjide3xu4xw3uc</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count</title>
   <ns>828</ns>
   <id>61792794</id>
   <revision>
     <id>1050945237</id>
     <parentid>1036845225</parentid>
     <timestamp>2021-10-20T19:51:20Z</timestamp>
     <contributor>
       <username>MusikBot II</username>
       <id>29539620</id>
     </contributor>
     <minor/>
     <comment>Changed protection settings for "Module:Transclusion count": High-risk template or module: 3791 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="1484" xml:space="preserve">local p = {}

function p.fetch(frame) local template = nil local return_value = nil

-- Use demo parameter if it exists, otherswise use current template name local namespace = mw.title.getCurrentTitle().namespace if frame.args["demo"] and frame.args["demo"] ~= "" then template = frame.args["demo"] elseif namespace == 10 then -- Template namespace template = mw.title.getCurrentTitle().text elseif namespace == 828 then -- Module namespace template = (mw.site.namespaces[828].name .. ":" .. mw.title.getCurrentTitle().text) end

-- If in template or module namespace, look up count in /data if template ~= nil then namespace = mw.title.new(template, "Template").namespace if namespace == 10 or namespace == 828 then template = mw.ustring.gsub(template, "/doc$", "") -- strip /doc from end local index = mw.ustring.sub(mw.title.new(template).text,1,1) local status, data = pcall(function () return(mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))) end) if status then return_value = tonumber(data[mw.ustring.gsub(template, " ", "_")]) end end end

-- If database value doesn't exist, use value passed to template if return_value == nil and frame.args[1] ~= nil then local arg1=mw.ustring.match(frame.args[1], '[%d,]+') if arg1 and arg1 ~= then return_value = tonumber(frame:callParserFunction('formatnum', arg1, 'R')) end end

return return_value end

return p</text>

     <sha1>3ib1zdtyys7kfdg4esyswexwq73t7wl</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Transclusion count/data/I</title>
   <ns>828</ns>
   <id>61481780</id>
   <revision>
     <id>1050327856</id>
     <parentid>1049151757</parentid>
     <timestamp>2021-10-17T05:16:15Z</timestamp>
     <contributor>
       <username>Ahechtbot</username>
       <id>26109785</id>
     </contributor>
     <minor/>
     <comment>Bot: Updated page.</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="22449" xml:space="preserve">return {

["IAAF_name"] = 2300, ["IAST"] = 5700, ["IBDB_name"] = 8700, ["ICD10"] = 4600, ["ICD9"] = 4400, ["ICS"] = 2600, ["IDN"] = 3000, ["IMDB_name"] = 2600, ["IMDB_title"] = 3300, ["IMDb_episode"] = 8400, ["IMDb_name"] = 143000, ["IMDb_title"] = 177000, ["IMO_Number"] = 3800, ["IMSLP"] = 7600, ["IND"] = 7300, ["INR"] = 5400, ["INRConvert"] = 5000, ["INRConvert/CurrentRate"] = 5000, ["INRConvert/USD"] = 5000, ["INRConvert/out"] = 5000, ["IOC_profile"] = 7300, ["IP"] = 2400, ["IPA"] = 116000, ["IPA-all"] = 3100, ["IPA-de"] = 6800, ["IPA-es"] = 7400, ["IPA-fr"] = 26000, ["IPA-it"] = 5500, ["IPA-nl"] = 3200, ["IPA-pl"] = 3800, ["IPA-pt"] = 3500, ["IPA-ru"] = 2500, ["IPA-sh"] = 2900, ["IPA-sl"] = 6700, ["IPA-th"] = 2700, ["IPA_audio_link"] = 14000, ["IPA_link"] = 2200, ["IPAc-cmn"] = 2400, ["IPAc-en"] = 43000, ["IPAc-pl"] = 52000, ["IPC_athlete"] = 2300, ["IPSummary"] = 76000, ["IP_summary"] = 76000, ["IPsock"] = 31000, ["IPtalk"] = 27000, ["IPuser"] = 6800, ["IPvandal"] = 13000, ["IRC"] = 10000, ["IRL"] = 5200, ["IRN"] = 3300, ["ISBN"] = 454000, ["ISBNT"] = 35000, ["ISO_15924/script-example-character"] = 2500, ["ISO_15924/wp-article"] = 2600, ["ISO_15924/wp-article/format"] = 2600, ["ISO_15924/wp-article/label"] = 2500, ["ISO_3166_code"] = 215000, ["ISO_3166_name"] = 16000, ["ISO_639_name"] = 5900, ["ISP"] = 21000, ["ISP_test"] = 5600, ["ISR"] = 4300, ["ISSN"] = 11000, ["ISSN_link"] = 29000, ["ISTAT"] = 8100, ["ISU_figure_skater"] = 2400, ["ITA"] = 16000, ["ITF"] = 5400, ["ITF_profile"] = 7700, ["ITIS"] = 4100, ["ITN_talk"] = 8100, ["ITN_talk/date"] = 8100, ["IUCN_banner"] = 14000, ["I_sup"] = 4200, ["Iaaf_name"] = 7700, ["Ice_hockey"] = 20000, ["Ice_hockey_stats"] = 14000, ["Icehockeystats"] = 11000, ["Icon"] = 524000, ["If"] = 137000, ["If_all"] = 7800, ["If_between"] = 3600, ["If_both"] = 8610000, ["If_either"] = 4900, ["If_empty"] = 2540000, ["If_first_display_both"] = 58000, ["If_in_page"] = 7100, ["If_last_display_both"] = 26000, ["If_preview"] = 54000, ["If_then_show"] = 204000, ["Ifempty"] = 3500, ["Ifeq"] = 2200, ["Ifexist_not_redirect"] = 431000, ["Ifnotempty"] = 14000, ["Ifnumber"] = 21000, ["Ifor"] = 611000, ["Ifsubst"] = 50000, ["Ih"] = 7300, ["Ill"] = 78000, ["Illm"] = 6400, ["Image_frame"] = 2800, ["Image_label"] = 4300, ["Image_label_begin"] = 3600, ["Image_label_end"] = 3200, ["Image_label_small"] = 2500, ["Image_needed"] = 4300, ["Image_other"] = 320000, ["Image_requested"] = 165000, ["Image_requested/Category_helper"] = 159000, ["Imbox"] = 904000, ["Imdb_name"] = 7500, ["Imdb_title"] = 14000, ["Importance"] = 5290000, ["Importance/colour"] = 5300000, ["Importance_mask"] = 8290000, ["Improve_categories"] = 5400, ["In_class"] = 4500, ["In_lang"] = 337000, ["In_string"] = 55000, ["In_title"] = 15000, ["Inactive_WikiProject_banner"] = 167000, ["Inactive_userpage_blanked"] = 4500, ["Include-USGov"] = 30000, ["Incomplete_list"] = 20000, ["Increase"] = 36000, ["Incumbent_pope"] = 4300, ["Independent/meta/color"] = 4500, ["Independent_(US)/meta/color"] = 2600, ["Independent_(politician)/meta/color"] = 13000, ["Independent_(politician)/meta/shortname"] = 11000, ["Independent_politician/meta/color"] = 20000, ["Independent_politician/meta/shortname"] = 16000, ["IndexFungorum"] = 2200, ["Indian_English"] = 3800, ["Indian_National_Congress/meta/color"] = 4500, ["Indian_National_Congress/meta/shortname"] = 3300, ["Indian_Rupee"] = 9000, ["Indian_railway_code"] = 3100, ["Inflation"] = 15000, ["Inflation-fn"] = 4900, ["Inflation-year"] = 3800, ["Inflation/IN/startyear"] = 5000, ["Inflation/UK"] = 3700, ["Inflation/UK/dataset"] = 3700, ["Inflation/UK/startyear"] = 3700, ["Inflation/US"] = 9200, ["Inflation/US/dataset"] = 9200, ["Inflation/US/startyear"] = 9200, ["Inflation/fn"] = 5300, ["Inflation/year"] = 19000, ["Info"] = 7800, ["Infobox"] = 3530000, ["Infobox/mobileviewfix.css"] = 3900, ["Infobox3cols"] = 276000, ["Infobox_AFL_biography"] = 14000, ["Infobox_Aircraft_Begin"] = 7900, ["Infobox_Aircraft_Type"] = 7100, ["Infobox_Athletics_Championships"] = 2400, ["Infobox_Australian_place"] = 15000, ["Infobox_CFL_biography"] = 6000, ["Infobox_CFL_biography/position"] = 5900, ["Infobox_COA_wide"] = 2500, ["Infobox_Canada_electoral_district"] = 2400, ["Infobox_Chinese"] = 17000, ["Infobox_Chinese/Footer"] = 8700, ["Infobox_Chinese/Header"] = 8700, ["Infobox_Chinese/Korean"] = 14000, ["Infobox_Christian_leader"] = 16000, ["Infobox_Congressman"] = 2000, ["Infobox_Election"] = 3200, ["Infobox_French_commune"] = 37000, ["Infobox_GAA_player"] = 3400, ["Infobox_Gaelic_Athletic_Association_player"] = 4600, ["Infobox_German_location"] = 13000, ["Infobox_German_place"] = 14000, ["Infobox_Greece_place"] = 2700, ["Infobox_Greek_Dimos"] = 2700, ["Infobox_Hindu_temple"] = 2000, ["Infobox_Italian_comune"] = 8100, ["Infobox_Korean_name"] = 14000, ["Infobox_Korean_name/categories"] = 14000, ["Infobox_MLB_yearly"] = 3000, ["Infobox_NCAA_team_season"] = 22000, ["Infobox_NFL_biography"] = 26000, ["Infobox_NFL_player"] = 10000, ["Infobox_NFL_season"] = 2800, ["Infobox_NFL_team_season"] = 3800, ["Infobox_NRHP"] = 71000, ["Infobox_NRHP/conv"] = 17000, ["Infobox_NRHP/locmapin2region"] = 65000, ["Infobox_Newspaper"] = 2600, ["Infobox_Officeholder"] = 9100, ["Infobox_Olympic_event"] = 7000, ["Infobox_Olympic_event/games_text"] = 7000, ["Infobox_Organization"] = 2400, ["Infobox_Paralympic_event"] = 2500, ["Infobox_Paralympic_event/games_text"] = 2500, ["Infobox_Person"] = 2500, ["Infobox_Politician"] = 4400, ["Infobox_Romania_subdivision"] = 3100, ["Infobox_Romanian_subdivision"] = 3100, ["Infobox_Russian_district"] = 2000, ["Infobox_Russian_inhabited_locality"] = 3700, ["Infobox_SCOTUS_case"] = 3500, ["Infobox_SSSI"] = 2000, ["Infobox_Site_of_Special_Scientific_Interest"] = 2100, ["Infobox_Software"] = 2300, ["Infobox_State_Representative"] = 2200, ["Infobox_Swiss_town"] = 2800, ["Infobox_Switzerland_municipality"] = 2800, ["Infobox_U.S._county"] = 3000, ["Infobox_U.S._county/district"] = 3000, ["Infobox_UK_legislation"] = 2100, ["Infobox_UK_place"] = 25000, ["Infobox_UK_place/NoDialCode"] = 7600, ["Infobox_UK_place/NoPostCode"] = 2700, ["Infobox_UK_place/area"] = 2200, ["Infobox_UK_place/dist"] = 2400, ["Infobox_UK_place/local"] = 25000, ["Infobox_UK_place/styles.css"] = 25000, ["Infobox_UN_resolution"] = 2200, ["Infobox_US_Supreme_Court_case"] = 3600, ["Infobox_US_Supreme_Court_case/courts"] = 3600, ["Infobox_Vidhan_Sabha_constituency"] = 2500, ["Infobox_Wikipedia_user"] = 8400, ["Infobox_YouTube_personality"] = 2100, ["Infobox_academic"] = 9600, ["Infobox_aircraft_begin"] = 14000, ["Infobox_aircraft_occurrence"] = 2100, ["Infobox_aircraft_type"] = 13000, ["Infobox_airline"] = 4500, ["Infobox_airport"] = 16000, ["Infobox_airport/datatable"] = 15000, ["Infobox_album"] = 157000, ["Infobox_album/color"] = 181000, ["Infobox_album/link"] = 157000, ["Infobox_anatomy"] = 4400, ["Infobox_ancient_site"] = 4500, ["Infobox_animanga/Footer"] = 6100, ["Infobox_animanga/Header"] = 6100, ["Infobox_animanga/Print"] = 4800, ["Infobox_animanga/Video"] = 4300, ["Infobox_architect"] = 3200, ["Infobox_artist"] = 25000, ["Infobox_artist_discography"] = 5500, ["Infobox_artwork"] = 9700, ["Infobox_athlete"] = 4200, ["Infobox_attraction/status"] = 2800, ["Infobox_automobile"] = 7800, ["Infobox_award"] = 11000, ["Infobox_badminton_player"] = 2800, ["Infobox_baseball_biography"] = 27000, ["Infobox_baseball_biography/style"] = 27000, ["Infobox_baseball_biography/styles.css"] = 27000, ["Infobox_basketball_biography"] = 19000, ["Infobox_basketball_biography/style"] = 19000, ["Infobox_basketball_club"] = 2900, ["Infobox_beauty_pageant"] = 2100, ["Infobox_bilateral_relations"] = 4100, ["Infobox_body_of_water"] = 17000, ["Infobox_book"] = 48000, ["Infobox_boxer"] = 5300, ["Infobox_bridge"] = 5600, ["Infobox_building"] = 24000, ["Infobox_character"] = 7600, ["Infobox_chess_biography"] = 3100, ["Infobox_chess_player"] = 2800, ["Infobox_church"] = 13000, ["Infobox_church/denomination"] = 13000, ["Infobox_church/font_color"] = 13000, ["Infobox_civilian_attack"] = 4400, ["Infobox_college_coach"] = 11000, ["Infobox_college_sports_team_season"] = 34000, ["Infobox_college_sports_team_season/link"] = 34000, ["Infobox_college_sports_team_season/name"] = 34000, ["Infobox_college_sports_team_season/succession"] = 34000, ["Infobox_college_sports_team_season/team"] = 34000, ["Infobox_comic_book_title"] = 2800, ["Infobox_comics_character"] = 3700, ["Infobox_comics_creator"] = 3400, ["Infobox_company"] = 79000, ["Infobox_concert"] = 3000, ["Infobox_constituency"] = 4800, ["Infobox_country"] = 5600, ["Infobox_country/formernext"] = 5400, ["Infobox_country/imagetable"] = 4600, ["Infobox_country/multirow"] = 7400, ["Infobox_country/status_text"] = 2500, ["Infobox_country/styles.css"] = 5600, ["Infobox_country_at_games"] = 13000, ["Infobox_country_at_games/core"] = 13000, ["Infobox_country_at_games/see_also"] = 8500, ["Infobox_court_case"] = 4300, ["Infobox_court_case/images"] = 4300, ["Infobox_cricket_tournament"] = 2000, ["Infobox_cricketer"] = 31000, ["Infobox_cricketer/career"] = 31000, ["Infobox_cricketer/national_side"] = 7400, ["Infobox_criminal"] = 4800, ["Infobox_cultivar"] = 2300, ["Infobox_curler"] = 2400, ["Infobox_cycling_race_report"] = 4200, ["Infobox_cyclist"] = 16000, ["Infobox_dam"] = 4100, ["Infobox_designation_list"] = 17000, ["Infobox_designation_list/entry"] = 15000, ["Infobox_dim"] = 6200, ["Infobox_dim/core"] = 6200, ["Infobox_diocese"] = 3800, ["Infobox_drug"] = 8600, ["Infobox_drug/chemical_formula"] = 8600, ["Infobox_drug/formatATC"] = 8500, ["Infobox_drug/formatCASnumber"] = 8600, ["Infobox_drug/formatChEBI"] = 8600, ["Infobox_drug/formatChEMBL"] = 8600, ["Infobox_drug/formatChemDBNIAID"] = 8600, ["Infobox_drug/formatChemSpider"] = 8600, ["Infobox_drug/formatCompTox"] = 8600, ["Infobox_drug/formatDrugBank"] = 8600, ["Infobox_drug/formatIUPHARBPS"] = 8600, ["Infobox_drug/formatJmol"] = 8600, ["Infobox_drug/formatKEGG"] = 8600, ["Infobox_drug/formatPDBligand"] = 8000, ["Infobox_drug/formatPubChemCID"] = 8600, ["Infobox_drug/formatPubChemSID"] = 8600, ["Infobox_drug/formatUNII"] = 8600, ["Infobox_drug/legal_status"] = 8700, ["Infobox_drug/licence"] = 8600, ["Infobox_drug/maintenance_categories"] = 8600, ["Infobox_drug/pregnancy_category"] = 8600, ["Infobox_drug/title"] = 8600, ["Infobox_election"] = 25000, ["Infobox_election/row"] = 25000, ["Infobox_election/shortname"] = 23000, ["Infobox_enzyme"] = 5100, ["Infobox_ethnic_group"] = 6700, ["Infobox_event"] = 4000, ["Infobox_figure_skater"] = 4000, ["Infobox_film"] = 147000, ["Infobox_film/short_description"] = 147000, ["Infobox_film_awards"] = 2300, ["Infobox_film_awards/link"] = 2300, ["Infobox_film_awards/style"] = 2300, ["Infobox_food"] = 6400, ["Infobox_football_biography"] = 194000, ["Infobox_football_club"] = 25000, ["Infobox_football_club_season"] = 17000, ["Infobox_football_league"] = 2400, ["Infobox_football_league_season"] = 17000, ["Infobox_football_match"] = 5200, ["Infobox_football_tournament_season"] = 6300, ["Infobox_former_subdivision"] = 3000, ["Infobox_former_subdivision/styles.css"] = 3000, ["Infobox_game"] = 2200, ["Infobox_game_score"] = 3200, ["Infobox_gene"] = 13000, ["Infobox_given_name"] = 3800, ["Infobox_golfer"] = 4100, ["Infobox_golfer/highest_ranking"] = 4100, ["Infobox_government_agency"] = 9200, ["Infobox_gridiron_football_person"] = 3400, ["Infobox_gridiron_football_person/position"] = 5900, ["Infobox_gymnast"] = 3000, ["Infobox_handball_biography"] = 4600, ["Infobox_historic_site"] = 9800, ["Infobox_horseraces"] = 2500, ["Infobox_hospital"] = 5900, ["Infobox_hospital/care_system"] = 5900, ["Infobox_hospital/lists"] = 5900, ["Infobox_ice_hockey_player"] = 19000, ["Infobox_information_appliance"] = 2100, ["Infobox_international_football_competition"] = 5200, ["Infobox_islands"] = 8300, ["Infobox_islands/area"] = 8700, ["Infobox_islands/density"] = 8700, ["Infobox_islands/length"] = 8300, ["Infobox_islands/styles.css"] = 8300, ["Infobox_journal"] = 9300, ["Infobox_journal/Abbreviation_search"] = 9200, ["Infobox_journal/Bluebook_check"] = 9000, ["Infobox_journal/Former_check"] = 9000, ["Infobox_journal/ISO_4_check"] = 9000, ["Infobox_journal/ISSN-eISSN"] = 9000, ["Infobox_journal/Indexing_search"] = 9100, ["Infobox_journal/MathSciNet_check"] = 9000, ["Infobox_journal/NLM_check"] = 9000, ["Infobox_journal/frequency"] = 8200, ["Infobox_judge"] = 2700, ["Infobox_lake"] = 5000, ["Infobox_language"] = 9200, ["Infobox_language/family-color"] = 11000, ["Infobox_language/genetic"] = 6400, ["Infobox_language/linguistlist"] = 9200, ["Infobox_language/ref"] = 6900, ["Infobox_legislature"] = 3100, ["Infobox_lighthouse"] = 2600, ["Infobox_lighthouse/ARLHS"] = 2600, ["Infobox_lighthouse/NGA"] = 2600, ["Infobox_lighthouse/light"] = 2600, ["Infobox_locomotive"] = 4300, ["Infobox_magazine"] = 7000, ["Infobox_manner_of_address"] = 3000, ["Infobox_mapframe"] = 81000, ["Infobox_martial_artist"] = 5300, ["Infobox_martial_artist/record"] = 5300, ["Infobox_medal_templates"] = 397000, ["Infobox_medical_condition"] = 9200, ["Infobox_medical_condition_(new)"] = 8000, ["Infobox_military_conflict"] = 19000, ["Infobox_military_installation"] = 8900, ["Infobox_military_person"] = 41000, ["Infobox_military_structure"] = 2100, ["Infobox_military_unit"] = 24000, ["Infobox_mine"] = 2000, ["Infobox_model"] = 2300, ["Infobox_monarch"] = 2000, ["Infobox_mountain"] = 26000, ["Infobox_museum"] = 9200, ["Infobox_musical_artist"] = 116000, ["Infobox_musical_artist/color"] = 116000, ["Infobox_musical_artist/hCard_class"] = 297000, ["Infobox_musical_artist/tracking"] = 104000, ["Infobox_musical_composition"] = 2400, ["Infobox_name"] = 6900, ["Infobox_name_module"] = 10000, ["Infobox_newspaper"] = 9000, ["Infobox_nobility"] = 3000, ["Infobox_noble"] = 6600, ["Infobox_officeholder"] = 186000, ["Infobox_officeholder/office"] = 190000, ["Infobox_official_post"] = 6800, ["Infobox_organization"] = 33000, ["Infobox_pageant_titleholder"] = 2700, ["Infobox_park"] = 6600, ["Infobox_person"] = 420000, ["Infobox_person/Wikidata"] = 3600, ["Infobox_person/height"] = 107000, ["Infobox_person/length"] = 6700, ["Infobox_person/weight"] = 73000, ["Infobox_philosopher"] = 3000, ["Infobox_planet"] = 4600, ["Infobox_play"] = 3500, ["Infobox_political_party"] = 13000, ["Infobox_power_station"] = 2800, ["Infobox_prepared_food"] = 3800, ["Infobox_professional_wrestler"] = 3900, ["Infobox_professional_wrestling_event"] = 2300, ["Infobox_protected_area"] = 13000, ["Infobox_protein_family"] = 2100, ["Infobox_publisher"] = 2300, ["Infobox_racehorse"] = 5300, ["Infobox_racing_driver"] = 3200, ["Infobox_radio_station"] = 22000, ["Infobox_rail"] = 2700, ["Infobox_rail_line"] = 6700, ["Infobox_rail_line/tracking"] = 6700, ["Infobox_rail_service"] = 2700, ["Infobox_reality_competition_season"] = 2900, ["Infobox_record_label"] = 3900, ["Infobox_recurring_event"] = 5700, ["Infobox_religious_biography"] = 4400, ["Infobox_religious_building"] = 11000, ["Infobox_religious_building/color"] = 15000, ["Infobox_requested"] = 2600, ["Infobox_river"] = 29000, ["Infobox_river/calcunit"] = 29000, ["Infobox_river/discharge"] = 29000, ["Infobox_river/row-style"] = 29000, ["Infobox_river/source"] = 29000, ["Infobox_road"] = 24000, ["Infobox_road/banner"] = 13000, ["Infobox_road/browselinks/USA"] = 13000, ["Infobox_road/hide/cities"] = 2100, ["Infobox_road/maint/USA"] = 13000, ["Infobox_road/meta/colors"] = 2300, ["Infobox_road/meta/errors"] = 24000, ["Infobox_road/meta/mask/category"] = 23000, ["Infobox_road/meta/mask/country"] = 24000, ["Infobox_road/meta/mask/subtype1"] = 13000, ["Infobox_road/meta/mask/subtype2"] = 12000, ["Infobox_road/name/USA"] = 13000, ["Infobox_road/name/USA/StateName"] = 6300, ["Infobox_road/shield/USA"] = 13000, ["Infobox_road/shieldmain/USA"] = 13000, ["Infobox_road_small"] = 2200, ["Infobox_rockunit"] = 6300, ["Infobox_royalty"] = 19000, ["Infobox_royalty/short_description"] = 19000, ["Infobox_rugby_biography"] = 14000, ["Infobox_rugby_biography/correct_date"] = 14000, ["Infobox_rugby_biography/depcheck"] = 6700, ["Infobox_rugby_league_biography"] = 9400, ["Infobox_rugby_league_biography/PLAYER"] = 9300, ["Infobox_rugby_team"] = 2500, ["Infobox_saint"] = 4600, ["Infobox_school"] = 39000, ["Infobox_school/short_description"] = 39000, ["Infobox_school_district"] = 3800, ["Infobox_school_district/styles.css"] = 3000, ["Infobox_scientist"] = 43000, ["Infobox_service_record"] = 2500, ["Infobox_settlement"] = 540000, ["Infobox_settlement/areadisp"] = 219000, ["Infobox_settlement/columns"] = 87000, ["Infobox_settlement/columns/styles.css"] = 87000, ["Infobox_settlement/densdisp"] = 407000, ["Infobox_settlement/impus"] = 78000, ["Infobox_settlement/lengthdisp"] = 160000, ["Infobox_settlement/link"] = 87000, ["Infobox_settlement/metric"] = 196000, ["Infobox_settlement/pref"] = 273000, ["Infobox_settlement/styles.css"] = 532000, ["Infobox_ship_begin"] = 39000, ["Infobox_ship_career"] = 35000, ["Infobox_ship_characteristics"] = 39000, ["Infobox_ship_class_overview"] = 3800, ["Infobox_ship_image"] = 38000, ["Infobox_shopping_mall"] = 3300, ["Infobox_short_story"] = 2100, ["Infobox_skier"] = 2500, ["Infobox_soap_character"] = 3000, ["Infobox_software"] = 14000, ["Infobox_software/simple"] = 14000, ["Infobox_song"] = 71000, ["Infobox_song/color"] = 71000, ["Infobox_song/link"] = 71000, ["Infobox_spaceflight"] = 3400, ["Infobox_speed_skater"] = 2500, ["Infobox_sports_competition_event"] = 13000, ["Infobox_sports_competition_event/medalrow"] = 8500, ["Infobox_sports_league"] = 3600, ["Infobox_sports_season"] = 4400, ["Infobox_sports_team"] = 2100, ["Infobox_sportsperson"] = 103000, ["Infobox_stadium"] = 4600, ["Infobox_state_representative"] = 2700, ["Infobox_station"] = 52000, ["Infobox_station/doc"] = 52000, ["Infobox_station/services"] = 52000, ["Infobox_station/styles.css"] = 52000, ["Infobox_street"] = 2900, ["Infobox_swimmer"] = 9200, ["Infobox_television"] = 53000, ["Infobox_television_channel"] = 6200, ["Infobox_television_episode"] = 11000, ["Infobox_television_season"] = 8500, ["Infobox_television_station"] = 3700, ["Infobox_tennis_biography"] = 8700, ["Infobox_tennis_tournament_event"] = 16000, ["Infobox_tennis_tournament_year"] = 8200, ["Infobox_tennis_tournament_year/color"] = 24000, ["Infobox_tennis_tournament_year/footer"] = 24000, ["Infobox_train"] = 2100, ["Infobox_tropical_cyclone"] = 2200, ["Infobox_union"] = 2200, ["Infobox_university"] = 26000, ["Infobox_user"] = 2600, ["Infobox_venue"] = 17000, ["Infobox_video_game"] = 26000, ["Infobox_volleyball_biography"] = 5100, ["Infobox_weapon"] = 7000, ["Infobox_website"] = 7500, ["Infobox_writer"] = 35000, ["Information"] = 119000, ["Inline"] = 2300, ["Inprogress"] = 2100, ["Input_link"] = 33000, ["Inputbox"] = 12000, ["Instagram"] = 8000, ["Interlanguage_link"] = 112000, ["Interlanguage_link_multi"] = 21000, ["Internet_Archive_author"] = 18000, ["Internet_Archive_film"] = 2300, ["Intitle"] = 9300, ["Invalid_SVG"] = 4200, ["Invalid_SVG/styles.css"] = 4200, ["Ipsock"] = 13000, ["Iptalk"] = 22000, ["IranCensus2006"] = 55000, ["IranNCSGN"] = 3300, ["Iran_Census_2006"] = 55000, ["Irc"] = 2100, ["Irish_place_name"] = 2400, ["IsValidPageName"] = 117000, ["Is_article"] = 4000, ["Is_country_in_Central_America"] = 12000, ["Is_country_in_the_Caribbean"] = 13000, ["Is_empty"] = 4300, ["Is_interwiki_link"] = 5900, ["Is_italic_taxon"] = 374000, ["Isbn"] = 5000, ["Isfdb_name"] = 3900, ["Isfdb_title"] = 4400, ["Isnumeric"] = 184000, ["Iso2continent"] = 24000, ["Iso2country"] = 21000, ["Iso2country/article"] = 21000, ["Iso2country/data"] = 21000, ["Iso2nationality"] = 68000, ["Issubst"] = 79000, ["Isu_name"] = 2200, ["Italic_dab2"] = 4900, ["Italic_title"] = 770000, ["Italic_title_prefixed"] = 8200, ["Italics_colon"] = 2900, ["Italictitle"] = 5100, ["Ivm"] = 5700, ["Ivm/styles.css"] = 5700, ["Ivmbox"] = 114000, ["Ivory_messagebox"] = 114000, ["Module:I18n/complex_date"] = 63000, ["Module:IP"] = 76000, ["Module:IPA_symbol"] = 3400, ["Module:IPA_symbol/data"] = 3400, ["Module:IPAc-en"] = 43000, ["Module:IPAc-en/data"] = 43000, ["Module:IPAc-en/phonemes"] = 43000, ["Module:IPAc-en/pronunciation"] = 43000, ["Module:IPAddress"] = 99000, ["Module:ISO_3166"] = 689000, ["Module:ISO_3166/data/AT"] = 2500, ["Module:ISO_3166/data/BA"] = 3300, ["Module:ISO_3166/data/CA"] = 2500, ["Module:ISO_3166/data/DE"] = 14000, ["Module:ISO_3166/data/ES"] = 2900, ["Module:ISO_3166/data/FR"] = 38000, ["Module:ISO_3166/data/GB"] = 5800, ["Module:ISO_3166/data/GR"] = 2900, ["Module:ISO_3166/data/IN"] = 26000, ["Module:ISO_3166/data/National"] = 689000, ["Module:ISO_3166/data/RS"] = 3200, ["Module:ISO_3166/data/RU"] = 24000, ["Module:ISO_3166/data/TR"] = 2100, ["Module:ISO_3166/data/US"] = 80000, ["Module:ISO_639_name"] = 13000, ["Module:ISOdate"] = 63000, ["Module:Icon"] = 524000, ["Module:Icon/data"] = 524000, ["Module:If_empty"] = 2540000, ["Module:If_in_page"] = 7100, ["Module:If_preview"] = 427000, ["Module:If_preview/configuration"] = 427000, ["Module:If_preview/styles.css"] = 427000, ["Module:In_lang"] = 337000, ["Module:Infobox"] = 3790000, ["Module:Infobox/dates"] = 62000, ["Module:Infobox/styles.css"] = 1800000, ["Module:Infobox3cols"] = 289000, ["Module:InfoboxImage"] = 4050000, ["Module:Infobox_body_of_water_tracking"] = 17000, ["Module:Infobox_cyclist_tracking"] = 16000, ["Module:Infobox_film/track"] = 147000, ["Module:Infobox_gene"] = 13000, ["Module:Infobox_mapframe"] = 341000, ["Module:Infobox_military_conflict"] = 19000, ["Module:Infobox_military_conflict/styles.css"] = 19000, ["Module:Infobox_multi-lingual_name"] = 17000, ["Module:Infobox_multi-lingual_name/data"] = 17000, ["Module:Infobox_power_station"] = 2800, ["Module:Infobox_road"] = 26000, ["Module:Infobox_road/color"] = 24000, ["Module:Infobox_road/length"] = 24000, ["Module:Infobox_road/locations"] = 24000, ["Module:Infobox_road/map"] = 24000, ["Module:Infobox_road/meta/mask/country"] = 15000, ["Module:Infobox_road/route"] = 2200, ["Module:Infobox_television"] = 51000, ["Module:Infobox_television_disambiguation_check"] = 59000, ["Module:Infobox_television_episode"] = 11000, ["Module:Infobox_television_season_disambiguation_check"] = 8100, ["Module:Infobox_television_season_name"] = 8600, ["Module:Internet_Archive"] = 18000, ["Module:IrelandByCountyCatNav"] = 2500, ["Module:Is_infobox_in_lead"] = 345000, ["Module:Italic_title"] = 1040000, ["Module:Italic_title2"] = 4900, }</text>

     <sha1>ewytx7ju186758taq4p2uqt0atjac5p</sha1>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>948473803</id>
     <parentid>948472535</parentid>
     <timestamp>2020-04-01T06:27:55Z</timestamp>
     <contributor>
       <username>MusikAnimal</username>
       <id>14882394</id>
     </contributor>
     <comment>Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]])</comment>
     <model>Scribunto</model>
     <format>text/plain</format>
     <text bytes="745" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template 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 val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end</text>

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

</mediawiki>