Template:Infobox

From HPCwiki
Revision as of 09:56, 24 November 2013 by Hjmegens (talk | contribs)
Jump to navigation Jump to search

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

Examples:

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Text in caption over infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Text in caption over infobox</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Text in caption over infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Text in caption over infobox</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> </pre>Template:Clear

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}{{{title}}}</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:Text in uppermost cell of infobox
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

Text in uppermost cell of infobox</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}{{{title}}}</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:Text in uppermost cell of infobox
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

Text in uppermost cell of infobox</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:lang="en">

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Example of an undesirable header and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Example of an undesirable header
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Example of an undesirable header</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Example of an undesirable header and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Example of an undesirable header
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Example of an undesirable header</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Example of an optional header and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Example of an optional header
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Example of an optional header</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Example of an optional header and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Example of an optional header
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Example of an optional header</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> </pre>Template:Clear

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Test Infobox and Above text, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:File:Example.png|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Test Infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Test Infobox</th>
     </tr>
   }}<!--
-->{{#if:File:Example.png
    |<tr><td class="" style="padding:0.2em 0 0.4em;">File:Example.png<!--
          -->{{#if:Caption displayed below example.png |<div style="padding-top:0.2em;line-height:1.2em;">Caption displayed below example.png</div>}}</td>
     </tr>
   }}<!--
-->{{#if:Above text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;background:#cfc;"><!--newline required for bullet-points to work:-->

Above text</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: Below text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;background:#ddf;">

Below text</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Test Infobox and Above text, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:File:Example.png|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Test Infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Test Infobox</th>
     </tr>
   }}<!--
-->{{#if:File:Example.png
    |<tr><td class="" style="padding:0.2em 0 0.4em;">File:Example.png<!--
          -->{{#if:Caption displayed below example.png |<div style="padding-top:0.2em;line-height:1.2em;">Caption displayed below example.png</div>}}</td>
     </tr>
   }}<!--
-->{{#if:Above text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;background:#cfc;"><!--newline required for bullet-points to work:-->

Above text</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: Below text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;background:#ddf;">

Below text</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> </pre>Template:Clear

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

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Test Infobox and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;width:20em">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Test Infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Test Infobox</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: Below text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

Below text</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Test Infobox and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;width:20em">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Test Infobox
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Test Infobox</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: Below text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

Below text</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> </pre>Template:Clear

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now no limit to the number of rows that can be defined in a single instance of <code><nowiki><mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:lang="en">

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
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. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}{{{title}}}</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki></nowiki></code>.

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

 <siteinfo>
   <sitename>Wikipedia</sitename>
   <base>http://en.wikipedia.org/wiki/Main_Page</base>
   <generator>MediaWiki 1.23wmf4</generator>
   <case>first-letter</case>
   <namespaces>
     <namespace key="-2" case="first-letter">Media</namespace>
     <namespace key="-1" case="first-letter">Special</namespace>
     <namespace key="0" case="first-letter" />
     <namespace key="1" case="first-letter">Talk</namespace>
     <namespace key="2" case="first-letter">User</namespace>
     <namespace key="3" case="first-letter">User talk</namespace>
     <namespace key="4" case="first-letter">Wikipedia</namespace>
     <namespace key="5" case="first-letter">Wikipedia talk</namespace>
     <namespace key="6" case="first-letter">File</namespace>
     <namespace key="7" case="first-letter">File talk</namespace>
     <namespace key="8" case="first-letter">MediaWiki</namespace>
     <namespace key="9" case="first-letter">MediaWiki talk</namespace>
     <namespace key="10" case="first-letter">Template</namespace>
     <namespace key="11" case="first-letter">Template talk</namespace>
     <namespace key="12" case="first-letter">Help</namespace>
     <namespace key="13" case="first-letter">Help talk</namespace>
     <namespace key="14" case="first-letter">Category</namespace>
     <namespace key="15" case="first-letter">Category talk</namespace>
     <namespace key="100" case="first-letter">Portal</namespace>
     <namespace key="101" case="first-letter">Portal talk</namespace>
     <namespace key="108" case="first-letter">Book</namespace>
     <namespace key="109" case="first-letter">Book talk</namespace>
     <namespace key="446" case="first-letter">Education Program</namespace>
     <namespace key="447" case="first-letter">Education Program talk</namespace>
     <namespace key="710" case="first-letter">TimedText</namespace>
     <namespace key="711" case="first-letter">TimedText talk</namespace>
     <namespace key="828" case="first-letter">Module</namespace>
     <namespace key="829" case="first-letter">Module talk</namespace>
   </namespaces>
 </siteinfo>
 <page>
   <title>Template:Infobox</title>
   <ns>10</ns>
   <id>891845</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>558417008</id>
     <parentid>558281256</parentid>
     <timestamp>2013-06-05T09:16:23Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to Lua implementation - issues with Template:Infobox airline have now been addressed</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Infobox|infobox}}<noinclude>

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

     <sha1>kavlqnbr7pew8bhy59a3n9jmoau5jt4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Clear</title>
   <ns>10</ns>
   <id>1239772</id>
   <revision>
     <id>579832146</id>
     <parentid>557892365</parentid>
     <timestamp>2013-11-02T04:54:10Z</timestamp>
     <contributor>
       <username>Fuhghettaboutit</username>
       <id>665998</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Clear: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="81"><div style="clear:both;"></div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>6mk3e4afot6hzu6tzbljxxk83e14xv6</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Distinguish</title>
   <ns>10</ns>
   <id>3406012</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>523631744</id>
     <parentid>523631583</parentid>
     <timestamp>2012-11-18T07:30:44Z</timestamp>
     <contributor>
       <username>Dinoguy1000</username>
       <id>2412089</id>
     </contributor>
     <comment>right, I'm still an idiot =P&nbsp;</comment>
     <text xml:space="preserve" bytes="505">Template:Hatnote<noinclude><!-- splitting these lines causes Template:Documentation template to terminate green shading when Distinguish is used in /doc pages. -->

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

     <sha1>g7o4yc5l5v9lkjviygvr0ex3dq1ulgr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation</title>
   <ns>10</ns>
   <id>13529042</id>
   <revision>
     <id>577591885</id>
     <parentid>563934891</parentid>
     <timestamp>2013-10-17T16:26:00Z</timestamp>
     <contributor>
       <username>Mark Arsten</username>
       <id>15020596</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Documentation: Allowing Protected Template editors ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="2382"><!--
 Automatically add Template:Template sandbox notice when on a /sandbox page.

-->{{#ifeq: Infobox | sandbox | <div style="clear: both;"></div>Template:Template sandbox notice }}<!--

 Automatically add Template:Pp-template to protected templates.

-->Template:Template other<!--

 Start of green doc box.

-->Template:Documentation/start box2<!-- Start content --><!--

 Start load the /doc content:
 Note: The line breaks between this comment and the next line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

--> {{#switch: {{#if:|1|0}}{{#if:|1|0}}{{#ifexist:|1|0}}{{#ifexist:Template:Documentation/docspace:Template:Documentation/template page/doc|1|0}} | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 = | 0110 | 0111 = {{ {{{1}}} }} | 0001 | 0011 = {{ Template:Documentation/docspace:Template:Documentation/template page/doc }} | 0000 | 0100 | 0010 | 0101 = }} <!--

 End load the /doc content:
 Note: The line breaks between this comment and the previous line are necessary
 so  "=== Headings ===" at the start and end of docs are interpreted.

-->Template:Documentation/end box2<!--

 End of green doc box

--><noinclude>

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

     <sha1>mjkaa9gzxxkw9jtbx69ji2jqmczw0fl</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/docspace</title>
   <ns>10</ns>
   <id>29587406</id>
   <revision>
     <id>396601229</id>
     <parentid>396598491</parentid>
     <timestamp>2010-11-13T23:42:41Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/docspace: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="302">{{#switch: Template
 | 
 | File
 | MediaWiki
 | Category = Template talk
 | #default = Template

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

     <sha1>7f8iymss9sr4v7f4t5pza1arwjogrv3</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box</title>
   <ns>10</ns>
   <id>29586766</id>
   <revision>
     <id>542437204</id>
     <parentid>521646491</parentid>
     <timestamp>2013-03-06T20:51:38Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove interwiki text</comment>
     <text xml:space="preserve" bytes="4130"><noinclude><div></noinclude><div style="clear: both;"></div><!--So right or left floating items don't stick out of the doc box.-->

</div><!--End of green doc box--><!--

 Link box below for the doc meta-data:

-->{{#if:

 <!--Check if we should show the link box-->
 {{#ifeq:  | off
 |
 | yes{{
   #switch: Template
   | User
   | Template = yes
   }}
 }}

| Template:Fmbox }}<!--End link box--><!--

 Detect and report strange usage:

-->{{#if:

 <!--Check if Template:Documentation is transcluded 
     on a /doc or /testcases page-->
 {{#switch: Infobox
 | doc
 | testcases = strange
 }}
 <!--More checks can be added here, just return anything
     to make the surrounding if-case trigger-->

| <includeonly>[[Category:Wikipedia pages with strange ((documentation)) usage|Template:Main otherTemplate:Infobox]]<!-- Sort on namespace --></includeonly>

}}<noinclude> Template:Pp-template </noinclude></text>

     <sha1>0ureyobwxmpfh5nk2onuwq4n0yv4iqq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/end box2</title>
   <ns>10</ns>
   <id>29587251</id>
   <revision>
     <id>563934923</id>
     <parentid>563933457</parentid>
     <timestamp>2013-07-12T09:24:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>undo per talk - this breaks transclusions that use both the "1" and "content" parameters</comment>
     <text xml:space="preserve" bytes="880">Template:Documentation/end box<noinclude>

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

     <sha1>g2ve9s20z5yve6o48sscjqe0kkaz658</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box</title>
   <ns>10</ns>
   <id>29586753</id>
   <revision>
     <id>560807734</id>
     <parentid>545276199</parentid>
     <timestamp>2013-06-20T21:31:27Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>rearrange order and use mw-editsection class as per edit request</comment>
     <text xml:space="preserve" bytes="1960"><!--
 Start of green doc box

--><div id="template-documentation" class="template-documentation iezoomfix"><!--

 Add the heading at the top of the doc box:

-->{{#ifeq: ¬ | <!--Defined but empty--> | <!--"heading=", do nothing--> | <div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;"><span style="{{#if:

 | 
 | {{#ifeq: Template | Template
   | font-weight: bold; font-size: 125%
   | font-size: 150%
   }}
 }}">{{#switch: ¬
 | ¬ =   
   <!--"heading" not defined in this or previous level-->
   {{#switch: Template 
   | Template = File:Template-info.png Template documentation
   | Template:Ns:Module = File:Template-info.png Module documentation
   | File = Summary
   | #default = Documentation
   }}
 | #default = 
   <!--"heading" has data or is empty but defined-->
   
 }}</span>{{
 #if: 
 | 
 | <!--Add the [view][edit][history][purge] or [create] links-->
   <span class="mw-editsection plainlinks" id="doc_editlinks">{{
   #if: yes
   | &#91;view&#93; [edit] [history] [[[:Template:Purge]]] 
   | <!--/doc doesn't exist-->
     [#if:  _        | %7B%7B%7Bpreload%7D%7D%7D_        | {{#ifeq: Template | File_          | Template:Documentation/preload-filespace_          | Template:Documentation/preload_          }} }} create]
   }}</span>
 }}</div>

}}<noinclude><!-- close the div --></div>

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

     <sha1>1nqc1wpf3zz4xx0peh0nta6vwxz79rh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/start box2</title>
   <ns>10</ns>
   <id>29587220</id>
   <revision>
     <id>396602894</id>
     <parentid>396600453</parentid>
     <timestamp>2010-11-13T23:53:20Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>trim</comment>
     <text xml:space="preserve" bytes="641">Template:Documentation/start box<noinclude>

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

     <sha1>evvfdz38x89xmzvm8q6m4pimyhoko4m</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation/template page</title>
   <ns>10</ns>
   <id>29587443</id>
   <revision>
     <id>396601081</id>
     <parentid>396599183</parentid>
     <timestamp>2010-11-13T23:41:37Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Documentation/template page: Highly visible template: Will be used by Template:Documentation ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="232">{{#switch: Infobox

| sandbox | testcases = Infobox | #default = Infobox }}<noinclude>Template:Documentation</noinclude></text>

     <sha1>fenc3r6oe2sito28b1d8xgyo9gpq5uf</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Documentation subpage</title>
   <ns>10</ns>
   <id>7890381</id>
   <revision>
     <id>545980635</id>
     <parentid>544486970</parentid>
     <timestamp>2013-03-21T13:14:54Z</timestamp>
     <contributor>
       <username>TheDJ</username>
       <id>244887</id>
     </contributor>
     <comment>add support for module categories</comment>
     <text xml:space="preserve" bytes="1365"><includeonly>{{#ifeq: infobox | doc
 | <!-- doc page -->

</includeonly>{{

   #ifeq: show | show
   | Template:Mbox
   }}{{
   #if: 
   | <!-- skip -->
   | <includeonly>{{#ifexist:Template:Infobox|[[Category:{{
     #switch: Template
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}</includeonly>
 }}<includeonly>

| <!-- if not on a /doc subpage, do nothing --> }}</includeonly><noinclude> Template:Documentation <!-- Add categories to the /doc subpage, not here! --> </noinclude></text>

     <sha1>1kwmofdrn3aug3p16515jgyl1dtolpd</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Fmbox</title>
   <ns>10</ns>
   <id>19236000</id>
   <revision>
     <id>577983257</id>
     <parentid>577968772</parentid>
     <timestamp>2013-10-20T15:03:32Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>it should be Module:Message box, not Module:Fmbox - the former has deprecated the latter</comment>
     <text xml:space="preserve" bytes="141">{{#invoke:Message box|fmbox}}<noinclude>

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

     <sha1>q4qfnrd9je1n71bknyj9gdhs02g2rws</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Hatnote</title>
   <ns>10</ns>
   <id>945764</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>565053566</id>
     <parentid>565053264</parentid>
     <timestamp>2013-07-20T13:31:47Z</timestamp>
     <contributor>
       <username>Ceyockey</username>
       <id>150564</id>
     </contributor>
     <minor/>
     <comment>Reverted edits by Ceyockey (talk) to last version by GTBacchus</comment>
     <text xml:space="preserve" bytes="76"><div class="dablink">{{{1}}}</div><noinclude>

Template:Documentation </noinclude></text>

     <sha1>2h3hxi42jzxp1m2r8ytjvbz2kzdy88q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:High-risk</title>
   <ns>10</ns>
   <id>11453893</id>
   <revision>
     <id>545694711</id>
     <parentid>522386810</parentid>
     <timestamp>2013-03-20T14:36:58Z</timestamp>
     <contributor>
       <username>Dragons flight</username>
       <id>16980</id>
     </contributor>
     <comment>add support for Lua modules</comment>
     <text xml:space="preserve" bytes="1169">Template:Ombox<noinclude>

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

     <sha1>dd7f6f268jagvpcyas1p686ketbojhr</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Infobox/doc</title>
   <ns>10</ns>
   <id>15383540</id>
   <revision>
     <id>576307982</id>
     <parentid>575468680</parentid>
     <timestamp>2013-10-08T16:20:28Z</timestamp>
     <contributor>
       <username>Underlying lk</username>
       <id>10755432</id>
     </contributor>
     <comment>rem pointless spaces before every parameter</comment>
     <text xml:space="preserve" bytes="32223">Template:Documentation subpage

<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> Template:Distinguish <includeonly>{{#ifeq: {{#titleparts: Infobox | 1 | 2 }} | old | <!-- null --> | Template:High-riskTemplate:Lua }}</includeonly> This template is intended as a meta-template: a template used for constructing other templates. It is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to Template:Tl, but with an additional distinction. Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

To insert an image somewhere other than at the top of the infobox, or to insert freeform data, use a row with only a data field.

Optional control parameters

name
If this parameter is present, "view/discuss/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 in an article to the template code rather than the data in the infobox that 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.

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 as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title
Text to put in the caption over top of the table (or as as section header before the whole content of this table, if this is a child infobox).
above
Text to put within the uppermost cell of the table.
subheader(n)
additional title fields which fit below Top level title and {{{above}}}, but before images. Subheader parameters should not be spaced more than 10 apart.

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>File:Example.png</nowiki>. Image is centered by default. See WP:ALT for more on alt text. Image parameters should not be spaced more than 10 apart.
caption(n)
Text to put underneath the images.

Main data

header(n)
Text to use as a header in row n. Header and data parameters should not be spaced more than 50 apart.
label(n)
Text to use as a label in row n.
data(n)
Text to display as data in row n. Header and data parameters should not be spaced more than 50 apart.

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 Module:IncrementParams.

Note that although there is no limitation on the number of rows available, row parameters should not be numbered more than 50 apart. See the #Limitations section below for more details.

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 = {{ #if:  | {{{mass}}} kg }}

</pre>Template:Clear

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example: Template loop detected: Template:Infobox <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

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

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 emty row appears before the next static content. The trick to this is that the "#if" returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),

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

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.
headerstyle
Applies to all header cells
labelstyle
Applies to all label cells
datastyle
Applies to all data cells
belowstyle
Applies only to the below cell

HTML classes and microformats

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.

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 beig 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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

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

Embedding

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 more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now 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.

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 <pre style="overflow:auto"> Template loop detected: Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template loop detected: Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:Infobox|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:{{{type}}}
 |move=<!--
-->{{#ifeq:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:{{{type}}}

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#{{{type}}}|{{#switch:{{{type}}} |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:{{{type}}}

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:{{{type}}}|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:{{{type}}}|template

|{{#switch:10
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:{{{type}}}
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:Template talk|Template|talk page|

{{#switch:Template

|              = article
|File          = file
|Template      = template
|Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink"><span title="Purge this page">Purge</span></span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:Top level title
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}Top level title</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: Below text
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

Below text</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | {{{demospace}}}    <!--Use lower case "demospace"-->
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template loop detected: Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki> <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.

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 <pre style="overflow:auto"> Template:Infobox </pre>Template:Clear

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

Template:Sidebar <pre style="overflow:auto"> Template:Sidebar </pre>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 an higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

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

Limitations

Previously, the number of rows available to this template was limited to 99. This restriction has been lifted now that the template has been ported to a Lua module, but to maintain backwards compatibility there is now a limit on the number of rows apart by which parameters will be detected. If parameters are numbered more than 50 apart, the later parameters may be ignored (depending on the exact numbers involved), and if parameters are numbered more than 100 apart, the later parameters will definitely be ignored.

For example, this code will display properly:

Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">92</b>  = Data B
 |  label<b style="color:black;background:#AFA">136</b> = Label C
 |   data<b style="color:black;background:#AFA">136</b> = Data C
 | header<b style="color:black;background:#AFA">177</b> = Section 2
 |  label<b style="color:black;background:#AFA">215</b> = Label D
 |   data<b style="color:black;background:#AFA">215</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

But in this code, only Section 1, Label A and Data A will be displayed, because Data B is numbered too far away from Data A (and then all the rest is ignored):

Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#FAA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

Note that parameter values may be blank - parameters are counted unless they are completely absent, in header() and data(n), from the template invocation:

Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |   data<b style="color:black;background:#AFA">70</b>  =
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

If only label(n) is specified (even with a non-empty value) but neither header(n) nor data(n), the parameter is ignored and considered as if it was missing:

Template:Infobox <div style="overflow:auto">

<nowiki>{{</nowiki>Infobox
 | header<b style="color:black;background:#AFA">3</b>   = Section 1
 |  label<b style="color:black;background:#AFA">48</b>  = Label A
 |   data<b style="color:black;background:#AFA">48</b>  = Data A
 |  <b style="color:black;background:#FAA">label70</b>  = Dummy label
 |   data<b style="color:black;background:#AFA">102</b> = Data B
 |  label<b style="color:black;background:#AFA">103</b> = Label C
 |   data<b style="color:black;background:#AFA">103</b> = Data C
 | header<b style="color:black;background:#AFA">115</b> = Section 2
 |  label<b style="color:black;background:#AFA">120</b> = Label D
 |   data<b style="color:black;background:#AFA">120</b> = Data D
<nowiki>}}</nowiki>

</div>Template:Clear

There are also similar limitations for image(n) and subheader(n) parameters: in those cases, parameters should not be numbered more than 10 apart.

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also

<includeonly>{{#ifeq:SUBPAGENAME|sandbox|| }}</includeonly></text>

     <sha1>kqj90n1lp0qqe8l8ve6yjr02w2dyvki</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Lua</title>
   <ns>10</ns>
   <id>38752725</id>
   <revision>
     <id>581550772</id>
     <parentid>581152676</parentid>
     <timestamp>2013-11-13T23:37:05Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch back to type=notice per Johnuniq's comment on the talk page</comment>
     <text xml:space="preserve" bytes="1225">Template:Mbox<includeonly>{{#ifeq:  | true
|
| Template:Template other

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

     <sha1>f1sell7c1a7al6vu05h9kz29qcjg4q5</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Mbox</title>
   <ns>10</ns>
   <id>13319244</id>
   <revision>
     <id>577968069</id>
     <parentid>498386332</parentid>
     <timestamp>2013-10-20T12:33:38Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="145">{{#invoke:Message box|mbox}}<noinclude>

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

     <sha1>mpflpb6s8l8gaoxaeypyuqyu2w7vc7i</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Navbar</title>
   <ns>10</ns>
   <id>5277509</id>
   <revision>
     <id>579315044</id>
     <parentid>579312941</parentid>
     <timestamp>2013-10-29T17:48:00Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>Undid revision 579312941 by GraemeL (talk) Template:Pp-template is never necessary on a template that has Template:Documentation</comment>
     <text xml:space="preserve" bytes="1111"><includeonly><div class="noprint plainlinks hlist navbar {{#if:|mini}}" style=""><!--

-->{{#if:|<!--nothing-->|<!--else: --><span style="word-spacing:0;">This box: </span>}}<!--

-->{{#if:|<span style="margin-right:-0.125em;">&#91;</span>}}<!--

--><ul><!-- --><li class="nv-view">[[Template:Transclude|<span title="View this template" <!-- -->style="">{{#if:|v|view}}</span>]]</li><!--

--><li class="nv-talk">[[|<span title="Discuss this template" <!-- -->style="">{{#if:|t|talk}}</span>]]</li><!--

-->{{#if:|<!--nothing-->|<!--else: --><li class="nv-edit">[{{fullurl:Template:Transclude|action=edit}} <span title="Edit this template" <!-- -->style="">{{#if:|e|edit}}</span>]</li>}}<!-- --></ul><!--

-->{{#if:|<span style="margin-left:-0.125em;">&#93;</span>}}<!--

--></div></includeonly><noinclude>

Template:Documentation </noinclude></text>

     <sha1>l8vtirhspr68sezcde8873k75m5b4u4</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Ombox</title>
   <ns>10</ns>
   <id>17522403</id>
   <revision>
     <id>577969039</id>
     <parentid>463278061</parentid>
     <timestamp>2013-10-20T12:45:08Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>switch to Lua version</comment>
     <text xml:space="preserve" bytes="146">{{#invoke:Message box|ombox}}<noinclude>

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

     <sha1>1o93yrjvq6v2ylug2k0uaaltljurje2</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Para</title>
   <ns>10</ns>
   <id>16639086</id>
   <revision>
     <id>538878986</id>
     <parentid>417329083</parentid>
     <timestamp>2013-02-18T14:11:52Z</timestamp>
     <contributor>
       <username>Redrose64</username>
       <id>9612106</id>
     </contributor>
     <comment>move the style="white-space:nowrap;" to outermost level, per Template talk:Para#Suggested changes</comment>
     <text xml:space="preserve" bytes="224"><code style="white-space:nowrap;"><nowiki>|</nowiki>{{#if:|{{{1}}}<nowiki>=</nowiki>}}</code><noinclude>

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

     <sha1>qp4vv1v7gixzt5qqvjj03q2t15p1wgj</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta</title>
   <ns>10</ns>
   <id>13371038</id>
   <revision>
     <id>581284096</id>
     <parentid>581280097</parentid>
     <timestamp>2013-11-12T04:00:54Z</timestamp>
     <contributor>
       <username>Mlpearc</username>
       <id>8356162</id>
     </contributor>
     <comment>Define trgts</comment>
     <text xml:space="preserve" bytes="10995">{{#ifeq:{{#switch:[[:lc:{{{type}}}]]
 |move=<!--
-->{{#ifeq:
     {{#switch:lc:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |sysop|yes|no
   }}
 |create=<!--
-->{{#if:
     {{#switch:lc:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |template=<!--
-->{{#if:
     {{#switch:lc:undefined
       |templateeditor |template      = templateeditor
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |yes|no
   }}
 |pc1 =<!--
-->{{#ifeq:
     {{#switch:lc:undefined
       |pc1                           = autoconfirmed <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc1 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |autoconfirmed
     |yes|no
   }}
 |pc2 =<!--
-->{{#ifeq:
     {{#switch:lc:undefined
       |pc2                           = review <!-- this is the value that the PENDINGCHANGELEVEL magic word returns for pc2 -->
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = <!--fallback value: null
  -->}}
     |review
     |yes|no
   }}

|#default<!--includes all other types-->=<!--

-->{{#if:
     {{#switch:lc:undefined
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = <!--fallback value: null
  -->}}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = <!--fallback value: null-->}}
        |{{#switch:lc:undefined
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = <!--fallback value: null
      -->}}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:|yes| <div class="metadata topicon nopopups" id="protected-icon" style="display:none; right:{{#if:|{{{right}}}|55px}};">[[Image:{{#switch:[[:lc:{{{type}}}]]

|full=Padlock.svg
|semi=Padlock-silver.svg
|template=Padlock-pink.svg
|pc1=Padlock-silver-light.svg
|pc2=Padlock-orange.svg
|move=Padlock-olive.svg
|indef=Padlock-red.svg
|office=Padlock-black.svg
|create=Padlock-skyblue.svg
|#default=Transparent.gif

}}|20px|link=Wikipedia:Protection policy#[[:lc:{{{type}}}]]|{{#switch:[[:lc:{{{type}}}]] |pc1 = All edits by unregistered and new users are subject to review |pc2 = All edits by users who are not reviewers or administrators are subject to review |template = This is a permanently protected Template:Pp-meta/pagetype |#default = This Template:Pp-meta/pagetype is {{#switch:[[:lc:{{{type}}}]]

 |semi=semi-
 |move=move-
 |indef=permanently<nowiki> </nowiki>
 |create=creation-
 |office=<!--null, but should this have a special tag?-->
 |full
 |#default=<!--null-->
 }}protected

}}{{#ifeq:[[:lc:{{{type}}}]]|indef||{{#if:|<nowiki> </nowiki>until {{#time:F j, Y|{{{expiry}}}}}{{#if:|,}}}}}}{{#if:|<nowiki> </nowiki>{{{icon-reason}}}}}.|alt={{#ifeq:[[:lc:{{{type}}}]]|template

|{{#switch:NAMESPACENUMBER
  |10|828=Permanently protected Template:Pp-meta/pagetype
  |#default=Page permanently protected
 }}
|Page {{#switch:[[:lc:{{{type}}}]]
         |pc1=protected with pending changes level 1
         |pc2=protected with pending changes level 2
         |semi=semi-protected
         |move=move-protected
         |indef=permanently protected
         |create=creation-protected
         |office=<!--null, but should this have a special tag?-->
         |full
         |#default=protected
      }}

}}]]</div> |<!-- else, not small --> Template:Mbox }}|<includeonly></includeonly>}}<!--End if small--><includeonly>{{#ifeq:lc:no|no||}}</includeonly><noinclude>

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

     <sha1>51m7no5gxhcuqo906m2zsmzlt5zdreh</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-meta/pagetype</title>
   <ns>10</ns>
   <id>30446275</id>
   <revision>
     <id>579192830</id>
     <parentid>577799251</parentid>
     <timestamp>2013-10-29T00:01:09Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Template:Pp-meta/pagetype: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</comment>
     <text xml:space="preserve" bytes="267">{{#ifeq:TALKSPACE|NAMESPACE|talk page|

{{#switch:NAMESPACE

|              = article
|ns:File          = file
|ns:Template      = template
|ns:Category      = category
|Template:Ns:Module        = module
|#default             = page}}}}</text>
     <sha1>cb262v7tiv3i3v1x375mqdd5pur1d8q</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Pp-template</title>
   <ns>10</ns>
   <id>10225116</id>
   <revision>
     <id>578340995</id>
     <parentid>578337775</parentid>
     <timestamp>2013-10-23T00:53:07Z</timestamp>
     <contributor>
       <username>Equazcion</username>
       <id>2813350</id>
     </contributor>
     <comment>corrected icon rollover text</comment>
     <text xml:space="preserve" bytes="3563"><includeonly>Template:Pp-meta</includeonly><noinclude>

Template:Pp-template <!-- Show the small version --> Template:Pp-template <!-- Show the large version --> Template:Documentation <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude></text>

     <sha1>0f32k8jn0m1rwbfgys15odtk95eusit</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Purge</title>
   <ns>10</ns>
   <id>1188537</id>
   <restrictions>edit=sysop:move=sysop</restrictions>
   <revision>
     <id>567592458</id>
     <parentid>567590087</parentid>
     <timestamp>2013-08-07T20:57:58Z</timestamp>
     <contributor>
       <username>Waldir</username>
       <id>182472</id>
     </contributor>
     <comment>format anchor automatically. couldn't find a way to keep the hash symbol inside the #if:, but it does no harm outside anyway.</comment>
     <text xml:space="preserve" bytes="252"><span class="noprint plainlinks purgelink">[{{fullurl:FULLPAGENAME|action=purge}}#{{#if:|}} <span title="Purge this page">Purge</span>]</span><noinclude>

Template:Documentation </noinclude></text>

     <sha1>fg3egkc705ekna03dpzyrmnxz4qtz9t</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Sidebar</title>
   <ns>10</ns>
   <id>1960394</id>
   <revision>
     <id>557080250</id>
     <parentid>553354786</parentid>
     <timestamp>2013-05-27T22:15:40Z</timestamp>
     <contributor>
       <username>Plastikspork</username>
       <id>5075409</id>
     </contributor>
     <comment>Adding child = yes parameter per edit request</comment>
     <text xml:space="preserve" bytes="14945">{{#ifeq:|yes||<table class="vertical-navbox {{#ifeq:|true||nowraplinks}} " <!--
   -->cellspacing="{{#if: |{{{cellspacing}}} |5}}" <!--
   -->cellpadding="{{#if: |{{{cellpadding}}} |0}}" <!--
   -->style="float:{{#if: |{{{float}}} |right}};<!--
          -->clear:{{#ifeq:|none |both |{{#if: |{{{float}}} |right}}}};<!--
          -->width:{{#if: |{{{width}}} |22.0em}};<!--
            (margins:)-->{{#switch: |left=margin:0 1.0em 1.0em 0; |none|right|#default=margin:0 0 1.0em 1.0em;}}<!--
          -->background:#f9f9f9;border:1px solid #aaa;padding:0.2em;border-spacing:0.4em 0;text-align:center;line-height:1.4em;font-size:88%;">}}<!--
-->{{#ifeq:|yes||{{#if:
    |<caption class="" style="padding-bottom:0.2em;font-size:125%;line-height:1.2em;font-weight:bold;">{{{outertitle}}}</caption><!--
-->}}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style="padding:0.4em 0;">{{{topimage}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{topcaption}}}</div>}}</td>
     </tr>
   }}}}<!--
-->{{#ifeq:|yes||{{#if:
    |<tr><td class="" style=";{{#if: |padding-top:0.2em |padding-top:0.4em}};line-height:1.2em;">{{{pretitle}}}</td>
     </tr>
   }}}}<!--
-->{{#if:
    |{{#ifeq:|yes||<tr><th class="" style=";padding:0.2em 0.4em 0.2em;{{#if: |padding-top:0}};font-size:145%;line-height:1.2em;">}}{{{title}}}</th>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.2em 0 0.4em;">{{{image}}}<!--
          -->{{#if: |<div style="padding-top:0.2em;line-height:1.2em;">{{{caption}}}</div>}}</td>
     </tr>
   }}<!--
-->{{#if:
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;"><!--newline required for bullet-points to work:-->

{{{above}}}</td>

     </tr>
   }}<!--
heading#/content# starts here:
-->{{#if: |

<tr> <th class="" style="padding:0.1em;;;"> {{{heading1}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"><!-- newline required before contents# for bullets to work --> {{{content1}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading2}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content2}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading3}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content3}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading4}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> </td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading5}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content5}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading6}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content6}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading7}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content7}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading8}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content8}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading9}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content9}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading10}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content10}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading11}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content11}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading12}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content12}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading13}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content13}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading14}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content14}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading15}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content15}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading16}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content16}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading17}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content17}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading18}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content18}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading19}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content19}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading20}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content20}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading21}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content21}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading22}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content22}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading23}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content23}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading24}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content24}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading25}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content25}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading26}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content26}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading27}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content27}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading28}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content28}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading29}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content29}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading30}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content30}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading31}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content31}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading32}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content32}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading33}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content33}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading34}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content34}}}</td> </tr> }}{{#if: | <tr> <th class="" style="padding:0.1em;;;"> {{{heading35}}}</th> </tr> }}{{#if: | <tr> <td class="" style="padding:0 0.1em 0.4em;;"> {{{content35}}}</td> </tr> }}<!--

-->{{#if: 
    |<tr><td class="" style="padding:0.3em 0.4em 0.3em;font-weight:bold;">

{{{below}}}</td>

    </tr>
   }}<!--
-->{{#ifeq:|yes||{{#switch:<noinclude>off</noinclude>
    |none |off=
    |#default=<tr><td style="text-align:right;font-size:115%;">Template:Navbar</td></tr><!--
-->}}

</table>}}<noinclude>Template:Documentation<!-- Please add categories and interwikis to the bottom of Template:Sidebar/doc, not here --></noinclude></text>

     <sha1>5cyaygqh4p70kjblqvvmfcpllj0jwkq</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Template other</title>
   <ns>10</ns>
   <id>21418395</id>
   <revision>
     <id>388689098</id>
     <parentid>276896349</parentid>
     <timestamp>2010-10-04T14:47:12Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="435">{{#switch:
 <!--If no or empty "demospace" parameter then detect namespace-->
 {{#if:
 | [[:lc: {{{demospace}}}]]    <!--Use lower case "demospace"-->
 | {{#ifeq:NAMESPACE|ns:Template
   | template
   | other
   }}
 }}

| template = | other | #default = }}<!--End switch--><noinclude>

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

     <sha1>0tcssjmltwl7y5v3f5wj2kqciaabqly</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Tl</title>
   <ns>10</ns>
   <id>1487430</id>
   <restrictions>move=sysop:edit=sysop</restrictions>
   <revision>
     <id>388327745</id>
     <parentid>384906015</parentid>
     <timestamp>2010-10-02T19:12:49Z</timestamp>
     <contributor>
       <username>WOSlinker</username>
       <id>3138265</id>
     </contributor>
     <comment>remove Template:Pp-template</comment>
     <text xml:space="preserve" bytes="76">{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>

Template:Documentation

</noinclude></text>

     <sha1>ol1t4p5rix3sawawisp7kolp1s26zqz</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Template:Transclude</title>
   <ns>10</ns>
   <id>21843384</id>
   <revision>
     <id>275377931</id>
     <parentid>275377779</parentid>
     <timestamp>2009-03-06T12:09:04Z</timestamp>
     <contributor>
       <username>Happy-melon</username>
       <id>994084</id>
     </contributor>
     <minor/>
     <comment>Protected Template:Transclude: Highly visible template ([edit=sysop] (indefinite) [move=sysop] (indefinite))</comment>
     <text xml:space="preserve" bytes="400">{{#switch: 
|#default =  <!-- eg "User:Foo" -->
| = 
   {{#ifeq:  | 
     | Template:{{{1}}}            <!-- no leading colon, eg "Foo" -->
     |       <!-- leading colon, eg ":Foo", so we want the article -->
   }}

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

     <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
     <model>wikitext</model>
     <format>text/x-wiki</format>
   </revision>
 </page>
 <page>
   <title>Module:Category handler</title>
   <ns>828</ns>
   <id>39772274</id>
   <revision>
     <id>577959141</id>
     <parentid>577958700</parentid>
     <timestamp>2013-10-20T10:48:14Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Protected Module:Category handler: High-risk Lua module ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))</comment>
     <text xml:space="preserve" bytes="13065">----------------------------------------------------------------------------------------------------------

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



-- Configuration data -- -- Language-specific parameter names and values can be set here. --


local cfg = {}

-- The following config values set the names of parameters that suppress categorisation. They are used -- with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno(args[cfg.nocat]) Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno(args[cfg.categories]) Effect -- true Categorisation is allowed, and the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed cfg.nocat = 'nocat' cfg.categories = 'categories'

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

-- cfg.subpage is the parameter name to specify how to behave on subpages. cfg.subpageNo is the value to -- specify to not categorise on subpages; cfg.only is the value to specify to only categorise on subpages. cfg.subpage = 'subpage' cfg.subpageNo = 'no' cfg.subpageOnly = 'only'

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

-- The parameter name for data to return if no data is specified for the namespace that is detected. This -- must be the same as the cfg.other parameter in Module:Namespace detect. cfg.other = 'other'

-- The parameter name used to specify a page other than the current page; used for testing and -- demonstration. This must be the same as the cfg.page parameter in Module:Namespace detect. cfg.page = 'page'

-- The categorisation blacklist. Pages that match Lua patterns in this list will not be categorised. -- (However, see the explanation of cfg.nocat, cfg.categories and cfg.category2 for some exceptions.) -- If the namespace name has a space in, it must be written with an underscore, e.g. "Wikipedia_talk". -- Other parts of the title can have either underscores or spaces. cfg.blacklist = {

   '^Main Page$', -- don't categorise the main page.
   
   -- Don't categorise the following pages or their subpages.
   '^Wikipedia:Cascade%-protected items$',
   '^Wikipedia:Cascade%-protected items/.*$',
   '^User:UBX$', -- The userbox "template" space.
   '^User:UBX/.*$',
   '^User_talk:UBX$',
   '^User_talk:UBX/.*$',
   
   -- Don't categorise subpages of these pages, but allow
   -- categorisation of the base page.
   '^Wikipedia:Template messages/.+$',
   
   '/[aA]rchive' -- Don't categorise archives.

}

-- This is a table of namespaces to categorise by default. They should be in the format of parameter -- names accepted by Module:Namespace detect. cfg.defaultNamespaces = {

   'main',
   'file',
   'help',
   'category'

}


-- End configuration data --


-- Get dependent modules local nsDetect = require('Module:Namespace detect') local yesno = require('Module:Yesno')


-- Local functions -- -- The following are internal functions, which we do not want to be accessible from other modules. --


-- Find whether we need to return a category or not. local function needsCategory(pageObject, args)

   -- Don't categorise if the relevant options are set.
   if yesno(args[cfg.nocat])
       or yesno(args[cfg.categories]) == false
       or (
           args[cfg.category2] 
           and args[cfg.category2] ~= cfg.category2Yes 
           and args[cfg.category2] ~= cfg.category2Negative
       )
   then
       return false
   end
   -- If there is no pageObject available, then that either means that we are over
   -- the expensive function limit or that the title specified was invalid. Invalid
   -- titles will probably only be a problem during testing, so we choose the best
   -- fallback for being over the expensive function limit. The fallback behaviour
   -- of the old template was to assume the page was not a subpage, so we will do
   -- the same here.
   if args[cfg.subpage] == cfg.subpageNo and pageObject and pageObject.isSubpage then
       return false
   end
   if args[cfg.subpage] == cfg.subpageOnly 
       and (not pageObject or (pageObject and not pageObject.isSubpage))
   then
       return false
   end
   return true

end

-- Find whether we need to check the blacklist or not. local function needsBlacklistCheck(args)

   if yesno(args[cfg.nocat]) == false
       or yesno(args[cfg.categories]) == true
       or args[cfg.category2] == cfg.category2Yes
   then
       return false
   else
       return true
   end

end

-- Find whether any namespace parameters have been specified. -- Mappings is the table of parameter mappings taken from -- Module:Namespace detect. local function nsParamsExist(mappings, args)

   if args[cfg.all] or args[cfg.other] then
       return true
   end
   for ns, params in pairs(mappings) do
       for i, param in ipairs(params) do
           if args[param] then
               return true
           end
       end
   end
   return false

end


-- Global functions -- -- The following functions are global, because we want them to be accessible from #invoke and -- -- from other Lua modules. --


local p = {}

-- Find if a string matches the blacklist. Returns the match if one is found, or nil otherwise. -- Input should be a page title with a namespace prefix, e.g. "Wikipedia talk:Articles for deletion". function p.matchesBlacklist(page)

   if type(page) ~= 'string' then return end
   for i, pattern in ipairs(cfg.blacklist) do
       local match = mw.ustring.match(page, pattern)
       if match then
           return match
       end
   end

end

-- The main structure of the module. Checks whether we need to categorise, -- and then passes the relevant arguments to Module:Namespace detect. function p._main(args)

   -- Get the page object and argument mappings from
   -- Module:Namespace detect, to save us from having to rewrite the
   -- code.
   local pageObject = nsDetect.getPageObject(args[cfg.page])
   local mappings = nsDetect.getParamMappings()
   
   if not needsCategory(pageObject, args) then return end
   
   local ret = 
   -- Check blacklist if necessary.
   if not needsBlacklistCheck(args) or not p.matchesBlacklist(pageObject.prefixedText) then
       if not nsParamsExist(mappings, args) then
           -- No namespace parameters exist; basic usage. Pass args[1] to
           -- Module:Namespace detect using the default namespace
           -- parameters, and return the result.
           local ndargs = {}
           for _, ndarg in ipairs(cfg.defaultNamespaces) do
               ndargs[ndarg] = args[1]
           end
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           local ndresult = nsDetect._main(ndargs)
           if ndresult then
               ret = ret .. ndresult
           end
       else
           -- Namespace parameters exist; advanced usage.
           -- If the all parameter is specified, return it.
           local all = args.all
           if type(all) == 'string' then
               ret = ret .. all
           end
           
           -- Get the arguments to pass to Module:Namespace detect.
           local ndargs = {}
           for ns, params in pairs(mappings) do
               for _, param in ipairs(params) do
                   ndargs[param] = args[param] or args[cfg.other] or nil
               end
           end
           ndargs.other = args.other
           ndargs.page = args.page
           ndargs.demospace = args.demospace
           
           local data = nsDetect._main(ndargs)
           
           -- Work out what to return based on the result of the namespace detect call.
           local datanum = tonumber(data)
           if type(datanum) == 'number' then
               -- "data" is a number, so return that positional parameter.
               -- Remove non-positive integer values, as only positive integers
               -- from 1-10 were used with the old template.
               if datanum > 0 and math.floor(datanum) == datanum then
                   local dataArg = args[datanum]
                   if type(dataArg) == 'string' then
                       ret = ret .. dataArg
                   end
               end
           else
               -- "data" is not a number, so return it as it is.
               if type(data) == 'string' then
                   ret = ret .. data
               end
           end
       end
   end
   return ret

end

function p.main(frame)

   -- If called via #invoke, use the args passed into the invoking
   -- template, or the args passed to #invoke if any exist. Otherwise
   -- assume args are being passed directly in.
   local origArgs
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
       for k, v in pairs(frame.args) do
           origArgs = frame.args
           break
       end
   else
       origArgs = frame
   end
   -- Trim whitespace and remove blank arguments for the following args:
   -- 1, 2, 3 etc., "nocat", "categories", "subpage", and "page".
   local args = {}
   for k, v in pairs(origArgs) do
       if type(v) == 'string' then
           v = mw.text.trim(v) -- Trim whitespace.
       end
       if type(k) == 'number'
           or k == cfg.nocat
           or k == cfg.categories
           or k == cfg.subpage
           or k == cfg.page
       then
           if v ~=  then
               args[k] = v
           end
       else
           args[k] = v
       end
   end
   
   -- Lower-case "nocat", "categories", "category2", and "subpage". These
   -- parameters are put in lower case whenever they appear in the old
   -- template, so we can just do it once here and save ourselves some work.
   local lowercase = {cfg.nocat, cfg.categories, cfg.category2, cfg.subpage}
   for _, v in ipairs(lowercase) do
       local argVal = args[v]
       if type(argVal) == 'string' then
           args[v] = mw.ustring.lower(argVal)
       end
   end
   
   return p._main(args)

end

return p</text>

     <sha1>i2ez8nejriv7clde6mvnuwl3ypo3qj6</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:HtmlBuilder</title>
   <ns>828</ns>
   <id>38663961</id>
   <revision>
     <id>573509786</id>
     <parentid>558894130</parentid>
     <timestamp>2013-09-18T15:22:39Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>don't add attributes with no values, plus a couple of minor tweaks</comment>
     <text xml:space="preserve" bytes="4278">-- Module for building complex HTML (e.g. infoboxes, navboxes) using a fluent interface.

local HtmlBuilder = {}

local metatable = {}

metatable.__index = function(t, key)

   local ret = rawget(t, key)
   if ret then
       return ret
   end
   
   ret = metatable[key]
   if type(ret) == 'function' then
       return function(...) 
           return ret(t, ...) 
       end 
   else
       return ret
   end

end

metatable.__tostring = function(t)

   local ret = {}
   t._build(ret)
   return table.concat(ret)

end

metatable._build = function(t, ret)

   if t.tagName then 
       table.insert(ret, '<' .. t.tagName)
       for i, attr in ipairs(t.attributes) do
           table.insert(ret, ' ' .. attr.name .. '="' .. attr.val .. '"') 
       end
       if #t.styles > 0 then
           table.insert(ret, ' style="')
           for i, prop in ipairs(t.styles) do
               if type(prop) == 'string' then -- added with cssText()
                   table.insert(ret, prop .. ';')
               else -- added with css()
                   table.insert(ret, prop.name .. ':' .. prop.val .. ';')
               end
           end
           table.insert(ret, '"')
       end
       if t.selfClosing then
           table.insert(ret, ' /')
       end
       table.insert(ret, '>') 
   end
   for i, node in ipairs(t.nodes) do
       if node then
           if type(node) == 'table' then
               node._build(ret)
           else
               table.insert(ret, tostring(node))
           end
       end
   end
   if t.tagName and not t.unclosed and not t.selfClosing then
       table.insert(ret, '</' .. t.tagName .. '>')
   end

end

metatable.node = function(t, builder)

   if builder then
       table.insert(t.nodes, builder)
   end
   return t

end

metatable.wikitext = function(t, ...)

   local vals = {...}
   for i = 1, #vals do
       if vals[i] then
           table.insert(t.nodes, vals[i])
       end
   end
   return t

end

metatable.newline = function(t)

   table.insert(t.nodes, '\n')
   return t

end

metatable.tag = function(t, tagName, args)

   args = args or {}
   args.parent = t
   local builder = HtmlBuilder.create(tagName, args)
   table.insert(t.nodes, builder)
   return builder

end

local function getAttr(t, name)

   for i, attr in ipairs(t.attributes) do
       if attr.name == name then
           return attr
       end
   end

end

metatable.attr = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       -- if caller sets the style attribute explicitly, then replace all styles previously added with css() and cssText()
       if name == 'style' then
           t.styles = {val}
           return t
       end
       
       local attr = getAttr(t, name)
       if attr then
           attr.val = val
       else
           table.insert(t.attributes, {name = name, val = val})
       end
   end
   
   return t

end

metatable.addClass = function(t, class)

   if class then
       local attr = getAttr(t, 'class')
       if attr then
           attr.val = attr.val .. ' ' .. class
       else
           t.attr('class', class)
       end
   end
   
   return t

end

metatable.css = function(t, name, val)

   if type(val) == 'string' or type(val) == 'number' then
       for i, prop in ipairs(t.styles) do
           if prop.name == name then
               prop.val = val
               return t
           end
       end
       
       table.insert(t.styles, {name = name, val = val})
   end
   
   return t

end

metatable.cssText = function(t, css)

   if css then
       table.insert(t.styles, css)
   end
   return t

end

metatable.done = function(t)

   return t.parent or t

end

metatable.allDone = function(t)

   while t.parent do
       t = t.parent
   end
   return t

end

function HtmlBuilder.create(tagName, args)

   args = args or {}
   local builder = {}
   setmetatable(builder, metatable)
   builder.nodes = {}
   builder.attributes = {}
   builder.styles = {}
   builder.tagName = tagName
   builder.parent = args.parent
   builder.unclosed = args.unclosed or false
   builder.selfClosing = args.selfClosing or false
   return builder

end

return HtmlBuilder</text>

     <sha1>ait58gp3hn4i3oyevj1ucebrzvyok1o</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Infobox</title>
   <ns>828</ns>
   <id>38808424</id>
   <revision>
     <id>568027852</id>
     <parentid>563819331</parentid>
     <timestamp>2013-08-11T03:32:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>make rowclass apply to headers as well as data cells, per protected edit request</comment>
     <text xml:space="preserve" bytes="12914">--

-- This module implements Template:Infobox --

local p = {}

local HtmlBuilder = require('Module:HtmlBuilder')

local args = {} local origArgs local root

function union(t1, t2)

   -- Returns the union of the values of two tables, as a sequence.
   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

local function getArgNums(prefix)

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

local function addRow(rowArgs)

   -- Adds a row to the infobox, with either a header cell
   -- or a label/data cell combination.
   if rowArgs.header then
       root
           .tag('tr')
               .addClass(rowArgs.rowclass)
               .tag('th')
                   .attr('colspan', 2)
                   .addClass(rowArgs.class)
                   .css('text-align', 'center')
                   .cssText(args.headerstyle)
                   .wikitext(rowArgs.header)
   elseif rowArgs.data then
       local row = root.tag('tr')
       row.addClass(rowArgs.rowclass)
       if rowArgs.label then
           row
               .tag('th')
                   .attr('scope', 'row')
                   .css('text-align', 'left')
                   .cssText(args.labelstyle)
                   .wikitext(rowArgs.label)
                   .done()
       end
       
       local dataCell = row.tag('td')
       if not rowArgs.label then 
           dataCell
               .attr('colspan', 2)
               .css('text-align', 'center') 
       end
       dataCell
           .addClass(rowArgs.class)
           .cssText(rowArgs.datastyle)
           .newline()
           .wikitext(rowArgs.data)
   end

end

local function renderTitle()

   if not args.title then return end
   root
       .tag('caption')
           .addClass(args.titleclass)
           .cssText(args.titlestyle)
           .wikitext(args.title)

end

local function renderAboveRow()

   if not args.above then return end
   
   root
       .tag('tr')
           .tag('th')
               .attr('colspan', 2)
               .addClass(args.aboveclass)
               .css('text-align', 'center')
               .css('font-size', '125%')
               .css('font-weight', 'bold')
               .cssText(args.abovestyle)
               .wikitext(args.above)

end

local function renderBelowRow()

   if not args.below then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .addClass(args.belowclass)
               .css('text-align', 'center')
               .cssText(args.belowstyle)
               .newline()
               .wikitext(args.below)

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
       addRow({
           data = args['subheader' .. tostring(num)],
           datastyle = args.subheaderstyle or args['subheaderstyle' .. tostring(num)],
           class = args.subheaderclass,
           rowclass = args['subheaderrowclass' .. tostring(num)]
       })
   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 = HtmlBuilder.create().wikitext(args['image' .. tostring(num)])
       if caption then
           data
               .tag('br', {selfClosing = true})
                   .done()
               .tag('div')
                   .cssText(args.captionstyle)
                   .wikitext(caption)
       end
       addRow({
           data = tostring(data),
           datastyle = args.imagestyle,
           class = args.imageclass,
           rowclass = args['imagerowclass' .. tostring(num)]
       })
   end

end

local function renderRows()

   -- Gets the union of the header and data argument numbers,
   -- and renders them all in order using addRow.
   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)]
       })
   end

end

local function renderNavBar()

   if not args.name then return end
   
   root
       .tag('tr')
           .tag('td')
               .attr('colspan', '2')
               .css('text-align', 'right')
               .wikitext(mw.getCurrentFrame():expandTemplate({ 
                   title = 'navbar', 
                   args = { 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

local function renderTrackingCategories()

   if args.decat ~= 'yes' then
       if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
           root.wikitext()
       end
       if args.child == 'yes' and args.title then
           root.wikitext()
       end
   end

end

local function _infobox()

   -- Specify the overall layout of the infobox, with special settings
   -- if the infobox is used as a 'child' inside another infobox.
   if args.child ~= 'yes' then
       root = HtmlBuilder.create('table')
       
       root
           .addClass('infobox')
           .addClass(args.bodyclass)
           .attr('cellspacing', 3)
           .css('border-spacing', '3px')
           
           if args.subbox == 'yes' then
               root
                   .css('padding', '0')
                   .css('border', 'none')
                   .css('margin', '-3px')
                   .css('width', 'auto')
                   .css('min-width', '100%')
                   .css('font-size', '100%')
                   .css('clear', 'none')
                   .css('float', 'none')
                   .css('background-color', 'transparent')
           else
               root
                   .css('width', '22em')
           end
       root
           .cssText(args.bodystyle)
   
       renderTitle()
       renderAboveRow()
   else
       root = HtmlBuilder.create()
       
       root
           .wikitext(args.title)
   end
   renderSubheaders()
   renderImages() 
   renderRows() 
   renderBelowRow()  
   renderNavBar()
   renderItalicTitle()
   renderTrackingCategories()
   
   return tostring(root)

end

local function preprocessSingleArg(argName)

   -- 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.
   if origArgs[argName] and origArgs[argName] ~=  then
       args[argName] = origArgs[argName]
   end

end

local function preprocessArgs(prefixTable, step)

   -- 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.
   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
                   moreArgumentsExist = true -- Do another loop if any arguments are found, even blank ones.
                   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

function p.infobox(frame)

   -- If called via #invoke, use the args passed into the invoking template.
   -- Otherwise, for testing purposes, assume args are being passed directly in.
   if frame == mw.getCurrentFrame() then
       origArgs = frame:getParent().args
   else
       origArgs = frame
   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.
   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 = 'class'}
   }, 50)
   preprocessSingleArg('headerstyle')
   preprocessSingleArg('labelstyle')
   preprocessSingleArg('datastyle')
   preprocessSingleArg('below')
   preprocessSingleArg('belowclass')
   preprocessSingleArg('belowstyle')
   preprocessSingleArg('name')
   args['italic title'] = origArgs['italic title'] -- different behaviour if blank or absent
   preprocessSingleArg('decat')

   return _infobox()

end

return p</text>

     <sha1>73uuwy7s5v8l308m56yz8kalse7svrp</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box</title>
   <ns>828</ns>
   <id>40574910</id>
   <revision>
     <id>578398677</id>
     <parentid>577968334</parentid>
     <timestamp>2013-10-23T12:51:42Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix talk page links, and fix bug producing spurious WhatLinksHere links (however note that a link will appear for Foo if the code "talk=Foo" is used)</comment>
     <text xml:space="preserve" bytes="17329">-- 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.

-- Require necessary modules. local htmlBuilder = require('Module:HtmlBuilder') local categoryHandler = require('Module:Category handler').main local yesno = require('Module:Yesno')

-- Load the configuration page. local cfgTables = mw.loadData('Module:Message box/configuration')

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

-- Set aliases for often-used functions to reduce table lookups. local format = mw.ustring.format local tinsert = table.insert local tconcat = table.concat local trim = mw.text.trim

local box = {}

local function getTitleObject(page, ...) if type(page) == 'string' then -- 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, page, ...) if success then return title end 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 tinsert(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 tinsert(nums, tonumber(num)) end end table.sort(nums) return nums end

function box.getNamespaceId(ns) if not ns then return end if type(ns) == 'string' then ns = lang:ucfirst(mw.ustring.lower(ns)) if ns == 'Main' then ns = 0 end end local nsTable = mw.site.namespaces[ns] if nsTable then return nsTable.id end end

function box.getMboxType(nsid) -- Gets the mbox type from a namespace number. if nsid == 0 then return 'ambox' -- main namespace elseif nsid == 6 then return 'imbox' -- file namespace elseif nsid == 14 then return 'cmbox' -- category namespace else local nsTable = mw.site.namespaces[nsid] if nsTable and nsTable.isTalk then return 'tmbox' -- any talk namespace else return 'ombox' -- other namespaces or invalid input end end end

function box:addCat(ns, cat, sort) if type(cat) ~= 'string' then return end local nsVals = {'main', 'template', 'all'} local tname for i, val in ipairs(nsVals) do if ns == val then tname = ns .. 'Cats' end end if not tname then for i, val in ipairs(nsVals) do nsVals[i] = format('"%s"', val) end error('invalid ns parameter passed to box:addCat; valid values are ' .. mw.text.listToText(nsVals, nil, ' or ')) end self[tname] = self[tname] or {} if type(sort) == 'string' then tinsert(self[tname], format(, cat, sort)) else tinsert(self[tname], format(, cat)) end end

function box:addClass(class) if type(class) ~= 'string' then return end self.classes = self.classes or {} tinsert(self.classes, class) end

function box:setTitle(args) -- Get the title object and the namespace. self.pageTitle = getTitleObject(args.page ~= and args.page) self.title = self.pageTitle or mw.title.getCurrentTitle() self.demospace = args.demospace ~= and args.demospace or nil self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace end

function box:getConfig(boxType) -- Get the box config data from the data page. if boxType == 'mbox' then boxType = box.getMboxType(self.nsid) end local cfg = cfgTables[boxType] if not cfg then local boxTypes = {} for k, v in pairs(dataTables) do tinsert(boxTypes, format('"%s"', k)) end tinsert(boxTypes, '"mbox"') error(format('invalid message box type "%s"; valid types are %s', tostring(boxType), mw.text.listToText(boxTypes)), 2) end return cfg end

function box:removeBlankArgs(cfg, args) -- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams. local newArgs = {} for k, v in pairs(args) do if v ~= then newArgs[k] = v end end for i, param in ipairs(cfg.allowBlankParams or {}) do newArgs[param] = args[param] end return newArgs end

function box:setBoxParameters(cfg, args) -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image

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

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

-- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks') for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style

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

-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set, -- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match(self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$') or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false 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 = {} tinsert(issues, sect) tinsert(issues, issue) tinsert(issues, text) self.issue = tconcat(issues, ' ') end

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

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

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

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

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

-- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = 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

-- Add mainspace categories. At the moment these are only used in Template:Ambox. if cfg.allowMainspaceCategories then if args.cat then args.cat1 = args.cat end self.catNums = getArgNums(args, 'cat') if args.category then args.category1 = args.category end self.categoryNums = getArgNums(args, 'category') if args.all then args.all1 = args.all end self.allNums = getArgNums(args, 'all') self.categoryParamNums = union(self.catNums, self.categoryNums) self.categoryParamNums = union(self.categoryParamNums, self.allNums) -- 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(self.categoryParamNums) 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 = format('%s %s %s', mainCat, preposition, date) self:addCat('main', catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat('main', 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat('main', mainCat) end if allCat then self:addCat('main', allCat) end end end

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

-- Add template error category. 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('template', templateCat, templateSort) end

-- Categories for all namespaces. if self.invalidTypeError then local allSort = (self.nsid == 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

-- Convert category tables to strings and pass them through Module:Category handler. self.categories = categoryHandler{ main = tconcat(self.mainCats or {}), template = tconcat(self.templateCats or {}), all = tconcat(self.allCats or {}), nocat = args.nocat, demospace = self.demospace, page = self.pageTitle and self.pageTitle.prefixedText or nil } end

function box:export() local root = htmlBuilder.create()

-- Add the subst check error. if self.isSubstituted and self.name then root .tag('b') .addClass('error') .wikitext(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) for i, class in ipairs(self.classes or {}) do boxTable .addClass(class) end boxTable .cssText(self.style) .attr('role', 'presentation')

-- 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) 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) 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) local textCellSpan = textCell.tag('span') textCellSpan .addClass('mbox-text-span') .wikitext(self.issue) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.talk and ' ' .. self.talk) .wikitext(self.fix and ' ' .. self.fix) end textCellSpan .wikitext(self.date and ' ' .. self.date) if not self.isSmall then textCellSpan .tag('span') .addClass('hide-when-compact') .wikitext(self.info and ' ' .. self.info) end else -- Default text formatting - anything goes. textCell .cssText(self.textstyle) .wikitext(self.text) end

-- Add the right-hand image. if self.imageRight then local imageRightCell = row.tag('td').addClass('mbox-imageright') if self.imageCellDiv then imageRightCell = imageRightCell.tag('div').css('width', '52px') -- If we are using a div, redefine imageRightCell so that the image is inside it. end imageRightCell .wikitext(self.imageRight) 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) .wikitext(self.below) end

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

-- Add categories. root .wikitext(self.categories)

return tostring(root) end

local function main(boxType, args) box:setTitle(args) local cfg = box:getConfig(boxType) args = box:removeBlankArgs(cfg, args) box:setBoxParameters(cfg, args) return box:export() end

local function makeWrapper(boxType) return function (frame) -- If called via #invoke, use the args passed into the invoking -- template, or the args passed to #invoke if any exist. Otherwise -- assume args are being passed directly in from the debug console -- or from another Lua module. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = trim(v) end args[k] = v end return main(boxType, args) end end

local p = { main = main, mbox = makeWrapper('mbox') }

for boxType in pairs(cfgTables) do p[boxType] = makeWrapper(boxType) end

return p</text>

     <sha1>kqc9a9z2sp9egltcr2uq8vjbrmzjnw0</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Message box/configuration</title>
   <ns>828</ns>
   <id>40627038</id>
   <revision>
     <id>577968366</id>
     <parentid>577967964</parentid>
     <timestamp>2013-10-20T12:37:04Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Message box/configuration: used in system messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="5365">local ambox = {

types = { speedy = { class = 'ambox-speedy', image = 'Ambox speedy deletion.png' }, delete = { class = 'ambox-delete', image = 'Ambox deletion.png' }, content = { class = 'ambox-content', image = 'Ambox content.png' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Ambox move.png' }, protection = { class = 'ambox-protection', image = 'Ambox protection.png' }, notice = { class = 'ambox-notice', image = 'Ambox notice.png' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates',

       templateCategoryRequireName = true,

templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }

local cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Cmbox deletion.png' }, delete = { class = 'cmbox-delete', image = 'Cmbox deletion.png' }, content = { class = 'cmbox-content', image = 'Cmbox content.png' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Cmbox move.png' }, protection = { class = 'cmbox-protection', image = 'Cmbox protection.png' }, notice = { class = 'cmbox-notice', image = 'Cmbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }

local fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Cmbox deletion.png' }, editnotice = { class = 'fmbox-editnotice', image = 'Imbox notice.png' }, system = { class = 'fmbox-system', image = 'Imbox notice.png' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }

local imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'imbox-delete', image = 'Imbox deletion.png' }, content = { class = 'imbox-content', image = 'Imbox content.png' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Imbox move.png' }, protection = { class = 'imbox-protection', image = 'Imbox protection.png' }, license = { class = 'imbox-license', image = 'Imbox license.png' }, featured = { class = 'imbox-featured', image = 'Imbox featured.png' }, notice = { class = 'imbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }

local ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'ombox-delete', image = 'Imbox deletion.png' }, content = { class = 'ombox-content', image = 'Imbox content.png' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Imbox move.png' }, protection = { class = 'ombox-protection', image = 'Imbox protection.png' }, notice = { class = 'ombox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }

local tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Imbox speedy deletion.png' }, delete = { class = 'tmbox-delete', image = 'Imbox deletion.png' }, content = { class = 'tmbox-content', image = 'Imbox content.png' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg ' }, move = { class = 'tmbox-move', image = 'Imbox move.png' }, protection = { class = 'tmbox-protection', image = 'Imbox protection.png' }, notice = { class = 'tmbox-notice', image = 'Imbox notice.png' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' }

return { ambox = ambox, cmbox = cmbox, fmbox = fmbox, imbox = imbox, ombox = ombox, tmbox = tmbox }</text>

     <sha1>i6itxl4iu80rev2mzkihz2g67e08e3d</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Namespace detect</title>
   <ns>828</ns>
   <id>39762919</id>
   <revision>
     <id>579071375</id>
     <parentid>578798945</parentid>
     <timestamp>2013-10-28T07:47:48Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <comment>fix the education program namespace bug by replacing underscores with spaces in the getNamespace function</comment>
     <text xml:space="preserve" bytes="8303">----------------------------------------------------------------------------------------------------

-- -- -- NAMESPACE DETECT -- -- -- -- This module implements the Template:Namespace detect template in Lua, with a few -- -- improvements: all namespaces and all namespace aliases are supported, and namespace -- -- names are detected automatically for the local wiki. The module can also use the -- -- corresponding subject namespace value if it is used on a talk page. Parameter names -- -- can be configured for different wikis by altering the values in the "cfg" table. -- -- --



-- Configuration data -- -- Language-specific parameter names can be set here. --


local cfg = {}

-- This parameter displays content for the main namespace: cfg.main = 'main'

-- This parameter displays in talk namespaces: cfg.talk = 'talk'

-- This parameter displays content for "other" namespaces (namespaces for which -- parameters have not been specified, or for when cfg.demospace is set to cfg.other): cfg.other = 'other'

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

-- This parameter sets a demonstration namespace: cfg.demospace = 'demospace'

-- This parameter sets a specific page to compare: cfg.page = 'page'

-- The header for the namespace column in the wikitable containing the list of possible subject-space parameters. cfg.wikitableNamespaceHeader = 'Namespace'

-- The header for the wikitable containing the list of possible subject-space parameters. cfg.wikitableAliasesHeader = 'Aliases'


-- End configuration data --


local yesno = require('Module:Yesno')

local p = {}

function p.getPageObject(page) -- Get the page object, passing the function through pcall in case we are over the expensive function count limit. if page then local noError, pageObject = pcall(mw.title.new, page) if not noError then return nil else return pageObject end else return mw.title.getCurrentTitle() end end

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

local function getNamespace(args) -- Gets the namespace name from the page object. local page = args[cfg.page] local demospace = args[cfg.demospace] local subjectns = args[cfg.subjectns] local ret if demospace then -- Handle "demospace = main" properly. if mw.ustring.lower(demospace) == cfg.main then ret = mw.site.namespaces[0].name else ret = demospace end else local pageObject = p.getPageObject(page) if pageObject then if pageObject.isTalkPage then -- If cfg.subjectns is set, get the subject namespace, otherwise use cfg.talk. if yesno(subjectns) then ret = mw.site.namespaces[pageObject.namespace].subject.name else ret = cfg.talk end else ret = pageObject.nsText end else return nil -- return nil if the page object doesn't exist. end end ret = mw.ustring.gsub(ret, '_', ' ') return mw.ustring.lower(ret) end

function p._main(args) -- Get the namespace to compare the parameters to, and the parameter mapping table. local namespace = getNamespace(args) local mappings = p.getParamMappings() -- Check for any matches in the namespace arguments. The order we check them doesn't matter, -- as there can only be one match. for ns, params in pairs(mappings) do if ns == namespace then -- Check all aliases for matches. The default local namespace is checked first, as -- Template:Namespace detect checked these before alias names. for _, param in ipairs(params) do if args[param] ~= nil then return args[param] end end end end -- If there were no matches, return parameters for other namespaces. This happens if there -- was no text specified for the namespace that was detected or if the demospace parameter -- is not a valid namespace. Note that the parameter for the detected namespace must be -- completely absent for this to happen, not merely blank. if args[cfg.other] ~= nil then return args[cfg.other] end end

function p.main(frame) -- If called via #invoke, use the args passed into the invoking template, or the args -- passed to #invoke if any exist. Otherwise assume args are being passed directly in. local origArgs if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args for k, v in pairs(frame.args) do origArgs = frame.args break end else origArgs = frame end -- Trim whitespace and remove blank arguments for demospace and page parameters. local args = {} for k, v in pairs(origArgs) do if type(v) == 'string' then v = mw.text.trim(v) -- Trim whitespace. end if k == cfg.demospace or k == cfg.page then if v ~= then args[k] = v end else args[k] = v end end return p._main(args) end

function p.table(frame) --[[ Create a wikitable of all subject namespace parameters, for documentation purposes. The talk parameter is optional, in case it needs to be excluded in the documentation. ]] local useTalk = type(frame) == 'table' and type(frame.args) == 'table' and frame.args.talk == 'yes' -- Whether to use the talk parameter. local mappings = p.getParamMappings() -- Start the wikitable. local ret = '{| class="wikitable"' .. '\n|-' .. '\n! ' .. cfg.wikitableNamespaceHeader .. '\n! ' .. cfg.wikitableAliasesHeader

-- Generate the row for the main namespace, as we want this to be first in the list. ret = ret .. '\n|-' .. '\n| <code>' .. cfg.main .. '</code>' .. '\n|' if useTalk then ret = ret .. '\n|-' .. '\n| <code>' .. cfg.talk .. '</code>' .. '\n|' end -- Enclose all parameter names in <code> tags. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then for i, param in ipairs(params) do mappings[ns][i] = '<code>' .. param .. '</code>' end end end -- Generate the other wikitable rows. for ns, params in pairs(mappings) do if ns ~= mw.site.namespaces[0].name then -- Ignore the main namespace. ret = ret .. '\n|-' .. '\n| ' .. params[1] .. '\n| ' .. table.concat(params, ', ', 2) end end -- End the wikitable. ret = ret .. '\n|-' .. '\n|}' return ret end

return p</text>

     <sha1>8nite8fbarsnt5gq7agygh1b77hbaao</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>
 <page>
   <title>Module:Yesno</title>
   <ns>828</ns>
   <id>38665046</id>
   <revision>
     <id>582180209</id>
     <parentid>577959316</parentid>
     <timestamp>2013-11-18T09:30:00Z</timestamp>
     <contributor>
       <username>Mr. Stradivarius</username>
       <id>4708675</id>
     </contributor>
     <minor/>
     <comment>Changed protection level of Module:Yesno: High-risk Lua module: used in various interface messages ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))</comment>
     <text xml:space="preserve" bytes="565">-- Function allowing for consistent treatment of boolean-like wikitext input.

-- It works similarly to the template Template:Yesno. return function (val, default)

   val = type(val) == 'string' and mw.ustring.lower(val) or val -- put in lower case
   if val == nil then
       return nil
   elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then
       return false
   elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then
       return true
   else
       return default
   end

end</text>

     <sha1>6m5hkfmfntcpifshp9d2hksik4fa5nj</sha1>
     <model>Scribunto</model>
     <format>text/plain</format>
   </revision>
 </page>

</mediawiki>